diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/src/view/HelpWindow.java b/src/view/HelpWindow.java new file mode 100755 index 0000000..8528ee3 --- /dev/null +++ b/src/view/HelpWindow.java @@ -0,0 +1,118 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; +import java.io.*; + +import main.Ecologia; +import main.EcologiaIO; + +/** + * This window displays the help file for Ecologia. + * + * @author Daniel Vedder + * @version 03.03.2015 + */ +@SuppressWarnings("serial") +public class HelpWindow extends JFrame +{ + JTextArea text; + JScrollPane scroller; + Box main_panel, button_panel; + JButton help, concepts, license; + + public HelpWindow() + { + this.setTitle("Help"); + this.setSize(580, 450); + this.setLocation(300, 150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + createGUI(); + loadDocFile("help"); + } + + /** + * Add the text area which will display the text and the buttons to choose + * which text to display. + */ + public void createGUI() + { + //Add the text area + main_panel = new Box(BoxLayout.Y_AXIS); + text = new JTextArea(); + text.setEditable(false); + text.setLineWrap(true); + text.setWrapStyleWord(true); + scroller = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + main_panel.add(scroller); + main_panel.add(Box.createVerticalStrut(5)); + //Add the buttons + help = new JButton("Help"); + concepts = new JButton("Concepts"); + license = new JButton("License"); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("help"); + } + }); + concepts.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("concepts"); + } + }); + license.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("COPYING"); + } + }); + button_panel = new Box(BoxLayout.X_AXIS); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(help); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(concepts); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(license); + button_panel.add(Box.createVerticalStrut(3)); + main_panel.add(button_panel); + this.add(main_panel, BorderLayout.CENTER); + //Add some fillers for the optics + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.WEST); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + /** + * Load a documentation file. + * @param String fileName + */ + public void loadDocFile(String filename) + { + String helptext = ""; + try { + InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream("/doc/"+filename)); + BufferedReader helpfile_reader = new BufferedReader(isr); + String line = helpfile_reader.readLine(); + while (line != null) { + helptext = helptext+line+"\n"; + line = helpfile_reader.readLine(); + } + helpfile_reader.close(); + } + catch (IOException ioe) { + helptext = "Error loading file!"; + EcologiaIO.error("HelpWindow: could not load file 'doc/"+filename+"'!", ioe); + } + text.setText(helptext); + text.setCaretPosition(0); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/src/view/HelpWindow.java b/src/view/HelpWindow.java new file mode 100755 index 0000000..8528ee3 --- /dev/null +++ b/src/view/HelpWindow.java @@ -0,0 +1,118 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; +import java.io.*; + +import main.Ecologia; +import main.EcologiaIO; + +/** + * This window displays the help file for Ecologia. + * + * @author Daniel Vedder + * @version 03.03.2015 + */ +@SuppressWarnings("serial") +public class HelpWindow extends JFrame +{ + JTextArea text; + JScrollPane scroller; + Box main_panel, button_panel; + JButton help, concepts, license; + + public HelpWindow() + { + this.setTitle("Help"); + this.setSize(580, 450); + this.setLocation(300, 150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + createGUI(); + loadDocFile("help"); + } + + /** + * Add the text area which will display the text and the buttons to choose + * which text to display. + */ + public void createGUI() + { + //Add the text area + main_panel = new Box(BoxLayout.Y_AXIS); + text = new JTextArea(); + text.setEditable(false); + text.setLineWrap(true); + text.setWrapStyleWord(true); + scroller = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + main_panel.add(scroller); + main_panel.add(Box.createVerticalStrut(5)); + //Add the buttons + help = new JButton("Help"); + concepts = new JButton("Concepts"); + license = new JButton("License"); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("help"); + } + }); + concepts.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("concepts"); + } + }); + license.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("COPYING"); + } + }); + button_panel = new Box(BoxLayout.X_AXIS); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(help); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(concepts); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(license); + button_panel.add(Box.createVerticalStrut(3)); + main_panel.add(button_panel); + this.add(main_panel, BorderLayout.CENTER); + //Add some fillers for the optics + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.WEST); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + /** + * Load a documentation file. + * @param String fileName + */ + public void loadDocFile(String filename) + { + String helptext = ""; + try { + InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream("/doc/"+filename)); + BufferedReader helpfile_reader = new BufferedReader(isr); + String line = helpfile_reader.readLine(); + while (line != null) { + helptext = helptext+line+"\n"; + line = helpfile_reader.readLine(); + } + helpfile_reader.close(); + } + catch (IOException ioe) { + helptext = "Error loading file!"; + EcologiaIO.error("HelpWindow: could not load file 'doc/"+filename+"'!", ioe); + } + text.setText(helptext); + text.setCaretPosition(0); + } +} diff --git a/src/view/InfoBox.java b/src/view/InfoBox.java new file mode 100755 index 0000000..23080b5 --- /dev/null +++ b/src/view/InfoBox.java @@ -0,0 +1,189 @@ +package view; + +import java.awt.BorderLayout; +import java.util.HashMap; + +import javax.swing.*; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class is responsible for displaying information about a tile that was + * clicked on in the simulator. + * + * @author Daniel Vedder + * @version 4.9.2014 + */ +public class InfoBox extends JFrame +{ + private int xtile, ytile; //The coordinates of the currently active tile + private HashMap animalInfo; + private JTabbedPane tab_pane; + private Box tile_box, animal_box; + private JLabel coordinates, occupied_by, humidity, grasslevel; //JLabels needed for the tile panel + private JLabel id, type, energy, age, generation, parent, offspring, speed, stamina, efficiency; + private JLabel age_limit, strength, rep_energy, mat_age, gestation, repr_rate, eyesight, mut_rate; //JLabels needed for the animal panel + + /** + * The constructor. + */ + public InfoBox() + { + this.setTitle("Information"); + this.setSize(230, 380); + this.setLocation(400,150); + this.setAlwaysOnTop(true); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawInfoBox(); + } + + /** + * Initialise the infobox. + */ + private void drawInfoBox() + { + tab_pane = new JTabbedPane(); + this.add(tab_pane, BorderLayout.CENTER); + drawTileBox(); + drawAnimalBox(); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Draw the tile box. + */ + private void drawTileBox() + { + tile_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Tile", tile_box); + coordinates = new JLabel(); //Coordinates + tile_box.add(coordinates); + tile_box.add(Box.createVerticalStrut(10)); + occupied_by = new JLabel(); //Occupant + tile_box.add(occupied_by); + humidity = new JLabel(); //Humidity + tile_box.add(humidity); + grasslevel = new JLabel(); //Grass Density + tile_box.add(grasslevel); + } + + /** + * Draw the animal box. + */ + private void drawAnimalBox() + { + animal_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Animal", animal_box); + id = new JLabel("Animal ID: "); //ID number + animal_box.add(id); + type = new JLabel("Type: "); //Type + animal_box.add(type); + animal_box.add(Box.createVerticalStrut(10)); + energy = new JLabel("Energy: "); //Energy + animal_box.add(energy); + age = new JLabel("Age: "); //Age + animal_box.add(age); + generation = new JLabel("Generation: "); //Generation + animal_box.add(generation); + parent = new JLabel("Parent: "); //Parent ID + animal_box.add(parent); + offspring = new JLabel("Offspring: "); //Offspring + animal_box.add(offspring); + animal_box.add(Box.createVerticalStrut(10)); + animal_box.add(new JLabel("Genome")); + animal_box.add(Box.createVerticalStrut(5)); + speed = new JLabel("Speed: "); //Speed + animal_box.add(speed); + stamina = new JLabel("Stamina: "); //Speed + animal_box.add(stamina); + efficiency = new JLabel("Metabolic efficiency: "); //Efficiency + animal_box.add(efficiency); + age_limit = new JLabel("Age limit: "); //Age limit + animal_box.add(age_limit); + strength = new JLabel("Strength: "); //Strength + animal_box.add(strength); + rep_energy = new JLabel("Reproductive energy: "); //Reproduction energy + animal_box.add(rep_energy); + mat_age = new JLabel("Sexual maturity age: "); //Age of sexual maturity + animal_box.add(mat_age); + gestation = new JLabel("Gestation period: "); //Minimum length of the reproductive cycle + animal_box.add(gestation); + repr_rate = new JLabel("Reproduction rate: "); //Number of offspring per reproduction + animal_box.add(repr_rate); + eyesight = new JLabel("Eyesight range: "); //Eyesight + animal_box.add(eyesight); + mut_rate = new JLabel("Mutation rate: "); //Mutation rate + animal_box.add(mut_rate); + } + + /** + * Displays the information about the specified tile + * @param int Tile coordinates + */ + public void show(int tileX, int tileY) + { + xtile = tileX; + ytile = tileY; + refresh(); + this.setVisible(true); + EcologiaIO.debug("Showing InfoBox for ("+xtile+"/"+ytile+")"); + } + + /** + * Refresh the Infobox with the data of a new tile. + */ + public void refresh() + { + animalInfo = World.getInstance().getAnimalInfo(xtile, ytile); + coordinates.setText("Tile: "+xtile+"/"+ytile); + occupied_by.setText("Occupant: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + humidity.setText("Humidity: "+Humidity.getStatus(World.getInstance().getFieldInfo(xtile, ytile).get("Local humidity")).getString()); + grasslevel.setText("Grass density: "+World.getInstance().getFieldInfo(xtile, ytile).get("Grass density")); + if (animalInfo != null) { //Only display information if an animal actually occupies the tile + id.setText("Animal ID: "+animalInfo.get("ID")); + type.setText("Type: "+OccupantType.fromInt(animalInfo.get("Type")).toString()); + energy.setText("Energy: "+animalInfo.get("Energy")); + age.setText("Age: "+animalInfo.get("Age")); + generation.setText("Generation: "+animalInfo.get("Generation")); + parent.setText("Parent: "+animalInfo.get("Parent")); + offspring.setText("Offspring: "+animalInfo.get("Offspring")); + speed.setText("Speed: "+animalInfo.get("Speed")); + stamina.setText("Stamina: "+animalInfo.get("Stamina")); + efficiency.setText("Efficiency: "+animalInfo.get("Metabolism")); + age_limit.setText("Age limit: "+animalInfo.get("Age limit")); + strength.setText("Strength: "+animalInfo.get("Strength")); + rep_energy.setText("Reproductive energy: "+animalInfo.get("Reproductive energy")); + mat_age.setText("Age of maturity: "+animalInfo.get("Maturity age")); + gestation.setText("Gestation period: "+animalInfo.get("Gestation")); + repr_rate.setText("Reproduction rate: "+animalInfo.get("Reproduction rate")); + eyesight.setText("Range of eyesight: "+animalInfo.get("Sight")); + mut_rate.setText("Mutation rate: "+animalInfo.get("Mutation rate")); + } + else { //If there is no animal here, display N/A + id.setText("Animal ID: N/A"); + type.setText("Type: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + energy.setText("Energy: N/A"); + age.setText("Age: N/A"); + generation.setText("Generation: N/A"); + parent.setText("Parent: N/A"); + offspring.setText("Offspring: N/A"); + speed.setText("Speed: N/A"); + stamina.setText("Stamina: N/A"); + efficiency.setText("Efficiency: N/A"); + age_limit.setText("Age limit: N/A"); + strength.setText("Strength: N/A"); + rep_energy.setText("Reproductive energy: N/A"); + mat_age.setText("Age of maturity: N/A"); + gestation.setText("Gestation period: N/A"); + repr_rate.setText("Reproduction rate: N/A"); + eyesight.setText("Range of eyesight: N/A"); + mut_rate.setText("Mutation rate: N/A"); + } + } + +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/src/view/HelpWindow.java b/src/view/HelpWindow.java new file mode 100755 index 0000000..8528ee3 --- /dev/null +++ b/src/view/HelpWindow.java @@ -0,0 +1,118 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; +import java.io.*; + +import main.Ecologia; +import main.EcologiaIO; + +/** + * This window displays the help file for Ecologia. + * + * @author Daniel Vedder + * @version 03.03.2015 + */ +@SuppressWarnings("serial") +public class HelpWindow extends JFrame +{ + JTextArea text; + JScrollPane scroller; + Box main_panel, button_panel; + JButton help, concepts, license; + + public HelpWindow() + { + this.setTitle("Help"); + this.setSize(580, 450); + this.setLocation(300, 150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + createGUI(); + loadDocFile("help"); + } + + /** + * Add the text area which will display the text and the buttons to choose + * which text to display. + */ + public void createGUI() + { + //Add the text area + main_panel = new Box(BoxLayout.Y_AXIS); + text = new JTextArea(); + text.setEditable(false); + text.setLineWrap(true); + text.setWrapStyleWord(true); + scroller = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + main_panel.add(scroller); + main_panel.add(Box.createVerticalStrut(5)); + //Add the buttons + help = new JButton("Help"); + concepts = new JButton("Concepts"); + license = new JButton("License"); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("help"); + } + }); + concepts.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("concepts"); + } + }); + license.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("COPYING"); + } + }); + button_panel = new Box(BoxLayout.X_AXIS); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(help); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(concepts); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(license); + button_panel.add(Box.createVerticalStrut(3)); + main_panel.add(button_panel); + this.add(main_panel, BorderLayout.CENTER); + //Add some fillers for the optics + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.WEST); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + /** + * Load a documentation file. + * @param String fileName + */ + public void loadDocFile(String filename) + { + String helptext = ""; + try { + InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream("/doc/"+filename)); + BufferedReader helpfile_reader = new BufferedReader(isr); + String line = helpfile_reader.readLine(); + while (line != null) { + helptext = helptext+line+"\n"; + line = helpfile_reader.readLine(); + } + helpfile_reader.close(); + } + catch (IOException ioe) { + helptext = "Error loading file!"; + EcologiaIO.error("HelpWindow: could not load file 'doc/"+filename+"'!", ioe); + } + text.setText(helptext); + text.setCaretPosition(0); + } +} diff --git a/src/view/InfoBox.java b/src/view/InfoBox.java new file mode 100755 index 0000000..23080b5 --- /dev/null +++ b/src/view/InfoBox.java @@ -0,0 +1,189 @@ +package view; + +import java.awt.BorderLayout; +import java.util.HashMap; + +import javax.swing.*; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class is responsible for displaying information about a tile that was + * clicked on in the simulator. + * + * @author Daniel Vedder + * @version 4.9.2014 + */ +public class InfoBox extends JFrame +{ + private int xtile, ytile; //The coordinates of the currently active tile + private HashMap animalInfo; + private JTabbedPane tab_pane; + private Box tile_box, animal_box; + private JLabel coordinates, occupied_by, humidity, grasslevel; //JLabels needed for the tile panel + private JLabel id, type, energy, age, generation, parent, offspring, speed, stamina, efficiency; + private JLabel age_limit, strength, rep_energy, mat_age, gestation, repr_rate, eyesight, mut_rate; //JLabels needed for the animal panel + + /** + * The constructor. + */ + public InfoBox() + { + this.setTitle("Information"); + this.setSize(230, 380); + this.setLocation(400,150); + this.setAlwaysOnTop(true); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawInfoBox(); + } + + /** + * Initialise the infobox. + */ + private void drawInfoBox() + { + tab_pane = new JTabbedPane(); + this.add(tab_pane, BorderLayout.CENTER); + drawTileBox(); + drawAnimalBox(); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Draw the tile box. + */ + private void drawTileBox() + { + tile_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Tile", tile_box); + coordinates = new JLabel(); //Coordinates + tile_box.add(coordinates); + tile_box.add(Box.createVerticalStrut(10)); + occupied_by = new JLabel(); //Occupant + tile_box.add(occupied_by); + humidity = new JLabel(); //Humidity + tile_box.add(humidity); + grasslevel = new JLabel(); //Grass Density + tile_box.add(grasslevel); + } + + /** + * Draw the animal box. + */ + private void drawAnimalBox() + { + animal_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Animal", animal_box); + id = new JLabel("Animal ID: "); //ID number + animal_box.add(id); + type = new JLabel("Type: "); //Type + animal_box.add(type); + animal_box.add(Box.createVerticalStrut(10)); + energy = new JLabel("Energy: "); //Energy + animal_box.add(energy); + age = new JLabel("Age: "); //Age + animal_box.add(age); + generation = new JLabel("Generation: "); //Generation + animal_box.add(generation); + parent = new JLabel("Parent: "); //Parent ID + animal_box.add(parent); + offspring = new JLabel("Offspring: "); //Offspring + animal_box.add(offspring); + animal_box.add(Box.createVerticalStrut(10)); + animal_box.add(new JLabel("Genome")); + animal_box.add(Box.createVerticalStrut(5)); + speed = new JLabel("Speed: "); //Speed + animal_box.add(speed); + stamina = new JLabel("Stamina: "); //Speed + animal_box.add(stamina); + efficiency = new JLabel("Metabolic efficiency: "); //Efficiency + animal_box.add(efficiency); + age_limit = new JLabel("Age limit: "); //Age limit + animal_box.add(age_limit); + strength = new JLabel("Strength: "); //Strength + animal_box.add(strength); + rep_energy = new JLabel("Reproductive energy: "); //Reproduction energy + animal_box.add(rep_energy); + mat_age = new JLabel("Sexual maturity age: "); //Age of sexual maturity + animal_box.add(mat_age); + gestation = new JLabel("Gestation period: "); //Minimum length of the reproductive cycle + animal_box.add(gestation); + repr_rate = new JLabel("Reproduction rate: "); //Number of offspring per reproduction + animal_box.add(repr_rate); + eyesight = new JLabel("Eyesight range: "); //Eyesight + animal_box.add(eyesight); + mut_rate = new JLabel("Mutation rate: "); //Mutation rate + animal_box.add(mut_rate); + } + + /** + * Displays the information about the specified tile + * @param int Tile coordinates + */ + public void show(int tileX, int tileY) + { + xtile = tileX; + ytile = tileY; + refresh(); + this.setVisible(true); + EcologiaIO.debug("Showing InfoBox for ("+xtile+"/"+ytile+")"); + } + + /** + * Refresh the Infobox with the data of a new tile. + */ + public void refresh() + { + animalInfo = World.getInstance().getAnimalInfo(xtile, ytile); + coordinates.setText("Tile: "+xtile+"/"+ytile); + occupied_by.setText("Occupant: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + humidity.setText("Humidity: "+Humidity.getStatus(World.getInstance().getFieldInfo(xtile, ytile).get("Local humidity")).getString()); + grasslevel.setText("Grass density: "+World.getInstance().getFieldInfo(xtile, ytile).get("Grass density")); + if (animalInfo != null) { //Only display information if an animal actually occupies the tile + id.setText("Animal ID: "+animalInfo.get("ID")); + type.setText("Type: "+OccupantType.fromInt(animalInfo.get("Type")).toString()); + energy.setText("Energy: "+animalInfo.get("Energy")); + age.setText("Age: "+animalInfo.get("Age")); + generation.setText("Generation: "+animalInfo.get("Generation")); + parent.setText("Parent: "+animalInfo.get("Parent")); + offspring.setText("Offspring: "+animalInfo.get("Offspring")); + speed.setText("Speed: "+animalInfo.get("Speed")); + stamina.setText("Stamina: "+animalInfo.get("Stamina")); + efficiency.setText("Efficiency: "+animalInfo.get("Metabolism")); + age_limit.setText("Age limit: "+animalInfo.get("Age limit")); + strength.setText("Strength: "+animalInfo.get("Strength")); + rep_energy.setText("Reproductive energy: "+animalInfo.get("Reproductive energy")); + mat_age.setText("Age of maturity: "+animalInfo.get("Maturity age")); + gestation.setText("Gestation period: "+animalInfo.get("Gestation")); + repr_rate.setText("Reproduction rate: "+animalInfo.get("Reproduction rate")); + eyesight.setText("Range of eyesight: "+animalInfo.get("Sight")); + mut_rate.setText("Mutation rate: "+animalInfo.get("Mutation rate")); + } + else { //If there is no animal here, display N/A + id.setText("Animal ID: N/A"); + type.setText("Type: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + energy.setText("Energy: N/A"); + age.setText("Age: N/A"); + generation.setText("Generation: N/A"); + parent.setText("Parent: N/A"); + offspring.setText("Offspring: N/A"); + speed.setText("Speed: N/A"); + stamina.setText("Stamina: N/A"); + efficiency.setText("Efficiency: N/A"); + age_limit.setText("Age limit: N/A"); + strength.setText("Strength: N/A"); + rep_energy.setText("Reproductive energy: N/A"); + mat_age.setText("Age of maturity: N/A"); + gestation.setText("Gestation period: N/A"); + repr_rate.setText("Reproduction rate: N/A"); + eyesight.setText("Range of eyesight: N/A"); + mut_rate.setText("Mutation rate: N/A"); + } + } + +} diff --git a/src/view/ProgramConfig.java b/src/view/ProgramConfig.java new file mode 100755 index 0000000..22428cd --- /dev/null +++ b/src/view/ProgramConfig.java @@ -0,0 +1,112 @@ +package view; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.BorderLayout; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.World; + +/** + * This class provides a GUI to configure program options (these can + * also be set via commandline flags). + * + * @author Daniel Vedder + * @version 22.03.2015 + */ +public class ProgramConfig extends JFrame +{ + private Box mainBox; + private JLabel heading; + private JCheckBox logging, debug, verbose, analyse; + private JButton apply; + + /** + * The constructor + */ + public ProgramConfig() + { + this.setTitle("Program Configuration"); + this.setSize(250, 230); + this.setLocation(300,200); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawConfigWindow(); + } + + private void drawConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + heading = new JLabel("Initial Parameter Settings"); + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + logging = new JCheckBox("Turn on logging"); + mainBox.add(logging); + mainBox.add(Box.createVerticalStrut(5)); + verbose = new JCheckBox("Provide verbose output"); + mainBox.add(verbose); + mainBox.add(Box.createVerticalStrut(5)); + debug = new JCheckBox("Print debug information"); + mainBox.add(debug); + mainBox.add(Box.createVerticalStrut(5)); + analyse = new JCheckBox("Print analysis information"); + mainBox.add(analyse); + mainBox.add(Box.createVerticalStrut(10)); + apply = new JButton("Apply"); + mainBox.add(apply); + mainBox.add(Box.createVerticalStrut(5)); + apply.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + updateWorld(); + setVisible(false); + } + }); + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Show the configuration window + * @param showRestart Show the restart dialog when closing this window? + */ + public void showConfig() + { + EcologiaIO.debug("ProgramConfig: showing config window."); + refresh(); + this.setVisible(true); + } + + /** + * Refresh values displayed in the text fields. + */ + public void refresh() + { + logging.setSelected(EcologiaIO.logging); + verbose.setSelected(EcologiaIO.verbose); + debug.setSelected(EcologiaIO.debugging); + analyse.setSelected(EcologiaIO.analysing); + } + + /** + * Extract all the settings from the text fields and update the world parameters + */ + public void updateWorld() + { + EcologiaIO.logging = logging.isSelected(); + EcologiaIO.verbose = verbose.isSelected(); + EcologiaIO.debugging = debug.isSelected(); + EcologiaIO.analysing = analyse.isSelected(); + EcologiaIO.printStatus(); + if (logging.isSelected()) + World.getInstance().giveNews("Logging to "+System.getProperty("user.dir")+"/ecologia.log"); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/src/view/HelpWindow.java b/src/view/HelpWindow.java new file mode 100755 index 0000000..8528ee3 --- /dev/null +++ b/src/view/HelpWindow.java @@ -0,0 +1,118 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; +import java.io.*; + +import main.Ecologia; +import main.EcologiaIO; + +/** + * This window displays the help file for Ecologia. + * + * @author Daniel Vedder + * @version 03.03.2015 + */ +@SuppressWarnings("serial") +public class HelpWindow extends JFrame +{ + JTextArea text; + JScrollPane scroller; + Box main_panel, button_panel; + JButton help, concepts, license; + + public HelpWindow() + { + this.setTitle("Help"); + this.setSize(580, 450); + this.setLocation(300, 150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + createGUI(); + loadDocFile("help"); + } + + /** + * Add the text area which will display the text and the buttons to choose + * which text to display. + */ + public void createGUI() + { + //Add the text area + main_panel = new Box(BoxLayout.Y_AXIS); + text = new JTextArea(); + text.setEditable(false); + text.setLineWrap(true); + text.setWrapStyleWord(true); + scroller = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + main_panel.add(scroller); + main_panel.add(Box.createVerticalStrut(5)); + //Add the buttons + help = new JButton("Help"); + concepts = new JButton("Concepts"); + license = new JButton("License"); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("help"); + } + }); + concepts.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("concepts"); + } + }); + license.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("COPYING"); + } + }); + button_panel = new Box(BoxLayout.X_AXIS); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(help); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(concepts); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(license); + button_panel.add(Box.createVerticalStrut(3)); + main_panel.add(button_panel); + this.add(main_panel, BorderLayout.CENTER); + //Add some fillers for the optics + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.WEST); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + /** + * Load a documentation file. + * @param String fileName + */ + public void loadDocFile(String filename) + { + String helptext = ""; + try { + InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream("/doc/"+filename)); + BufferedReader helpfile_reader = new BufferedReader(isr); + String line = helpfile_reader.readLine(); + while (line != null) { + helptext = helptext+line+"\n"; + line = helpfile_reader.readLine(); + } + helpfile_reader.close(); + } + catch (IOException ioe) { + helptext = "Error loading file!"; + EcologiaIO.error("HelpWindow: could not load file 'doc/"+filename+"'!", ioe); + } + text.setText(helptext); + text.setCaretPosition(0); + } +} diff --git a/src/view/InfoBox.java b/src/view/InfoBox.java new file mode 100755 index 0000000..23080b5 --- /dev/null +++ b/src/view/InfoBox.java @@ -0,0 +1,189 @@ +package view; + +import java.awt.BorderLayout; +import java.util.HashMap; + +import javax.swing.*; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class is responsible for displaying information about a tile that was + * clicked on in the simulator. + * + * @author Daniel Vedder + * @version 4.9.2014 + */ +public class InfoBox extends JFrame +{ + private int xtile, ytile; //The coordinates of the currently active tile + private HashMap animalInfo; + private JTabbedPane tab_pane; + private Box tile_box, animal_box; + private JLabel coordinates, occupied_by, humidity, grasslevel; //JLabels needed for the tile panel + private JLabel id, type, energy, age, generation, parent, offspring, speed, stamina, efficiency; + private JLabel age_limit, strength, rep_energy, mat_age, gestation, repr_rate, eyesight, mut_rate; //JLabels needed for the animal panel + + /** + * The constructor. + */ + public InfoBox() + { + this.setTitle("Information"); + this.setSize(230, 380); + this.setLocation(400,150); + this.setAlwaysOnTop(true); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawInfoBox(); + } + + /** + * Initialise the infobox. + */ + private void drawInfoBox() + { + tab_pane = new JTabbedPane(); + this.add(tab_pane, BorderLayout.CENTER); + drawTileBox(); + drawAnimalBox(); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Draw the tile box. + */ + private void drawTileBox() + { + tile_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Tile", tile_box); + coordinates = new JLabel(); //Coordinates + tile_box.add(coordinates); + tile_box.add(Box.createVerticalStrut(10)); + occupied_by = new JLabel(); //Occupant + tile_box.add(occupied_by); + humidity = new JLabel(); //Humidity + tile_box.add(humidity); + grasslevel = new JLabel(); //Grass Density + tile_box.add(grasslevel); + } + + /** + * Draw the animal box. + */ + private void drawAnimalBox() + { + animal_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Animal", animal_box); + id = new JLabel("Animal ID: "); //ID number + animal_box.add(id); + type = new JLabel("Type: "); //Type + animal_box.add(type); + animal_box.add(Box.createVerticalStrut(10)); + energy = new JLabel("Energy: "); //Energy + animal_box.add(energy); + age = new JLabel("Age: "); //Age + animal_box.add(age); + generation = new JLabel("Generation: "); //Generation + animal_box.add(generation); + parent = new JLabel("Parent: "); //Parent ID + animal_box.add(parent); + offspring = new JLabel("Offspring: "); //Offspring + animal_box.add(offspring); + animal_box.add(Box.createVerticalStrut(10)); + animal_box.add(new JLabel("Genome")); + animal_box.add(Box.createVerticalStrut(5)); + speed = new JLabel("Speed: "); //Speed + animal_box.add(speed); + stamina = new JLabel("Stamina: "); //Speed + animal_box.add(stamina); + efficiency = new JLabel("Metabolic efficiency: "); //Efficiency + animal_box.add(efficiency); + age_limit = new JLabel("Age limit: "); //Age limit + animal_box.add(age_limit); + strength = new JLabel("Strength: "); //Strength + animal_box.add(strength); + rep_energy = new JLabel("Reproductive energy: "); //Reproduction energy + animal_box.add(rep_energy); + mat_age = new JLabel("Sexual maturity age: "); //Age of sexual maturity + animal_box.add(mat_age); + gestation = new JLabel("Gestation period: "); //Minimum length of the reproductive cycle + animal_box.add(gestation); + repr_rate = new JLabel("Reproduction rate: "); //Number of offspring per reproduction + animal_box.add(repr_rate); + eyesight = new JLabel("Eyesight range: "); //Eyesight + animal_box.add(eyesight); + mut_rate = new JLabel("Mutation rate: "); //Mutation rate + animal_box.add(mut_rate); + } + + /** + * Displays the information about the specified tile + * @param int Tile coordinates + */ + public void show(int tileX, int tileY) + { + xtile = tileX; + ytile = tileY; + refresh(); + this.setVisible(true); + EcologiaIO.debug("Showing InfoBox for ("+xtile+"/"+ytile+")"); + } + + /** + * Refresh the Infobox with the data of a new tile. + */ + public void refresh() + { + animalInfo = World.getInstance().getAnimalInfo(xtile, ytile); + coordinates.setText("Tile: "+xtile+"/"+ytile); + occupied_by.setText("Occupant: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + humidity.setText("Humidity: "+Humidity.getStatus(World.getInstance().getFieldInfo(xtile, ytile).get("Local humidity")).getString()); + grasslevel.setText("Grass density: "+World.getInstance().getFieldInfo(xtile, ytile).get("Grass density")); + if (animalInfo != null) { //Only display information if an animal actually occupies the tile + id.setText("Animal ID: "+animalInfo.get("ID")); + type.setText("Type: "+OccupantType.fromInt(animalInfo.get("Type")).toString()); + energy.setText("Energy: "+animalInfo.get("Energy")); + age.setText("Age: "+animalInfo.get("Age")); + generation.setText("Generation: "+animalInfo.get("Generation")); + parent.setText("Parent: "+animalInfo.get("Parent")); + offspring.setText("Offspring: "+animalInfo.get("Offspring")); + speed.setText("Speed: "+animalInfo.get("Speed")); + stamina.setText("Stamina: "+animalInfo.get("Stamina")); + efficiency.setText("Efficiency: "+animalInfo.get("Metabolism")); + age_limit.setText("Age limit: "+animalInfo.get("Age limit")); + strength.setText("Strength: "+animalInfo.get("Strength")); + rep_energy.setText("Reproductive energy: "+animalInfo.get("Reproductive energy")); + mat_age.setText("Age of maturity: "+animalInfo.get("Maturity age")); + gestation.setText("Gestation period: "+animalInfo.get("Gestation")); + repr_rate.setText("Reproduction rate: "+animalInfo.get("Reproduction rate")); + eyesight.setText("Range of eyesight: "+animalInfo.get("Sight")); + mut_rate.setText("Mutation rate: "+animalInfo.get("Mutation rate")); + } + else { //If there is no animal here, display N/A + id.setText("Animal ID: N/A"); + type.setText("Type: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + energy.setText("Energy: N/A"); + age.setText("Age: N/A"); + generation.setText("Generation: N/A"); + parent.setText("Parent: N/A"); + offspring.setText("Offspring: N/A"); + speed.setText("Speed: N/A"); + stamina.setText("Stamina: N/A"); + efficiency.setText("Efficiency: N/A"); + age_limit.setText("Age limit: N/A"); + strength.setText("Strength: N/A"); + rep_energy.setText("Reproductive energy: N/A"); + mat_age.setText("Age of maturity: N/A"); + gestation.setText("Gestation period: N/A"); + repr_rate.setText("Reproduction rate: N/A"); + eyesight.setText("Range of eyesight: N/A"); + mut_rate.setText("Mutation rate: N/A"); + } + } + +} diff --git a/src/view/ProgramConfig.java b/src/view/ProgramConfig.java new file mode 100755 index 0000000..22428cd --- /dev/null +++ b/src/view/ProgramConfig.java @@ -0,0 +1,112 @@ +package view; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.BorderLayout; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.World; + +/** + * This class provides a GUI to configure program options (these can + * also be set via commandline flags). + * + * @author Daniel Vedder + * @version 22.03.2015 + */ +public class ProgramConfig extends JFrame +{ + private Box mainBox; + private JLabel heading; + private JCheckBox logging, debug, verbose, analyse; + private JButton apply; + + /** + * The constructor + */ + public ProgramConfig() + { + this.setTitle("Program Configuration"); + this.setSize(250, 230); + this.setLocation(300,200); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawConfigWindow(); + } + + private void drawConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + heading = new JLabel("Initial Parameter Settings"); + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + logging = new JCheckBox("Turn on logging"); + mainBox.add(logging); + mainBox.add(Box.createVerticalStrut(5)); + verbose = new JCheckBox("Provide verbose output"); + mainBox.add(verbose); + mainBox.add(Box.createVerticalStrut(5)); + debug = new JCheckBox("Print debug information"); + mainBox.add(debug); + mainBox.add(Box.createVerticalStrut(5)); + analyse = new JCheckBox("Print analysis information"); + mainBox.add(analyse); + mainBox.add(Box.createVerticalStrut(10)); + apply = new JButton("Apply"); + mainBox.add(apply); + mainBox.add(Box.createVerticalStrut(5)); + apply.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + updateWorld(); + setVisible(false); + } + }); + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Show the configuration window + * @param showRestart Show the restart dialog when closing this window? + */ + public void showConfig() + { + EcologiaIO.debug("ProgramConfig: showing config window."); + refresh(); + this.setVisible(true); + } + + /** + * Refresh values displayed in the text fields. + */ + public void refresh() + { + logging.setSelected(EcologiaIO.logging); + verbose.setSelected(EcologiaIO.verbose); + debug.setSelected(EcologiaIO.debugging); + analyse.setSelected(EcologiaIO.analysing); + } + + /** + * Extract all the settings from the text fields and update the world parameters + */ + public void updateWorld() + { + EcologiaIO.logging = logging.isSelected(); + EcologiaIO.verbose = verbose.isSelected(); + EcologiaIO.debugging = debug.isSelected(); + EcologiaIO.analysing = analyse.isSelected(); + EcologiaIO.printStatus(); + if (logging.isSelected()) + World.getInstance().giveNews("Logging to "+System.getProperty("user.dir")+"/ecologia.log"); + } +} diff --git a/src/view/SimulationConfig.java b/src/view/SimulationConfig.java new file mode 100755 index 0000000..05566bd --- /dev/null +++ b/src/view/SimulationConfig.java @@ -0,0 +1,179 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.*; + +import controller.World; +import main.Ecologia; +import main.EcologiaIO; + +/** + * This class is used to graphically configure simulation parameters + * prior to the start of a run. + * + * @author Daniel Vedder + * @version 30.12.2014 + */ +public class SimulationConfig extends JFrame +{ + private Box mainBox; + private JLabel heading, dimensions, waterLabel, nCarnLabel, nHerbLabel, grassLabel, energyCarnLabel, energyHerbLabel; + private JTextField width, height, no_water_tiles, no_carnivores, no_herbivores, grassDensity, energyHerbivores, energyCarnivores; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public SimulationConfig() + { + this.setTitle("Simulation Configuration"); + this.setSize(320, 320); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawConfigWindow(); + } + + /** + * Create the interface + */ + private void drawConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + heading = new JLabel("Initial Parameter Settings"); + //Dimension settings + dimensions = new JLabel("World dimensions (x*y): "); + width = new JTextField(String.valueOf(World.getInstance().getSize()[0]), 4); + height = new JTextField(String.valueOf(World.getInstance().getSize()[1]), 4); + Box dimBox = new Box(BoxLayout.X_AXIS); + dimBox.add(dimensions); + dimBox.add(Box.createHorizontalStrut(15)); + dimBox.add(width); + dimBox.add(Box.createHorizontalStrut(15)); + dimBox.add(height); + //Initial numbers of animals and water tiles + Box waterBox = new Box(BoxLayout.X_AXIS); + waterLabel = new JLabel("Number of water tiles: "); + no_water_tiles = new JTextField(String.valueOf(World.getInstance().getWaterTiles()), 3); + waterBox.add(waterLabel); + waterBox.add(Box.createHorizontalStrut(30)); + waterBox.add(no_water_tiles); + Box grassBox = new Box(BoxLayout.X_AXIS); + grassLabel = new JLabel("Starting grass density: "); + grassDensity = new JTextField(String.valueOf(World.getInstance().getStartGrassDensity()), 4); + grassBox.add(grassLabel); + grassBox.add(Box.createHorizontalStrut(25)); + grassBox.add(grassDensity); + Box nCarnBox = new Box(BoxLayout.X_AXIS); + nCarnLabel = new JLabel("Number of carnivores: "); + no_carnivores = new JTextField(String.valueOf(World.getInstance().getStartNoCarnivores()), 3); + nCarnBox.add(nCarnLabel); + nCarnBox.add(Box.createHorizontalStrut(25)); + nCarnBox.add(no_carnivores); + Box nHerbBox = new Box(BoxLayout.X_AXIS); + nHerbLabel = new JLabel("Number of herbivores: "); + no_herbivores = new JTextField(String.valueOf(World.getInstance().getStartNoHerbivores()), 3); + nHerbBox.add(nHerbLabel); + nHerbBox.add(Box.createHorizontalStrut(25)); + nHerbBox.add(no_herbivores); + //Initial energy for the animals + Box energyCarnBox = new Box(BoxLayout.X_AXIS); + energyCarnLabel = new JLabel("Start energy carnivores: "); + energyCarnivores = new JTextField(String.valueOf(World.getInstance().getStartEnergyCarnivores()), 4); + energyCarnBox.add(energyCarnLabel); + energyCarnBox.add(Box.createHorizontalStrut(25)); + energyCarnBox.add(energyCarnivores); + Box energyHerbBox = new Box(BoxLayout.X_AXIS); + energyHerbLabel = new JLabel("Start energy herbivores: "); + energyHerbivores = new JTextField(String.valueOf(World.getInstance().getStartEnergyHerbivores()), 4); + energyHerbBox.add(energyHerbLabel); + energyHerbBox.add(Box.createHorizontalStrut(25)); + energyHerbBox.add(energyHerbivores); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + EcologiaIO.log("SimulationConfig: World parameter settings updated."); + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) updateWorld(); + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(dimBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(grassBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(waterBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(nCarnBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(nHerbBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(energyCarnBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(energyHerbBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Show the configuration window + * @param showRestart Show the restart dialog when closing this window? + */ + public void showConfig(boolean showRestart) + { + EcologiaIO.debug("SimulationConfig: showing config window."); + showRestartDialog = showRestart; + refresh(); + this.setVisible(true); + } + + /** + * Refresh values displayed in the text fields. + */ + public void refresh() + { + width.setText(String.valueOf(World.getInstance().getSize()[0])); + height.setText(String.valueOf(World.getInstance().getSize()[1])); + grassDensity.setText(String.valueOf(World.getInstance().getStartGrassDensity())); + no_water_tiles.setText(String.valueOf(World.getInstance().getWaterTiles())); + no_carnivores.setText(String.valueOf(World.getInstance().getStartNoCarnivores())); + no_herbivores.setText(String.valueOf(World.getInstance().getStartNoHerbivores())); + energyCarnivores.setText(String.valueOf(World.getInstance().getStartEnergyCarnivores())); + energyHerbivores.setText(String.valueOf(World.getInstance().getStartEnergyHerbivores())); + } + + /** + * Extract all the settings from the text fields and update the world parameters + */ + public void updateWorld() + { + World.getInstance().setSize(new int[] {new Integer(width.getText()), new Integer(height.getText())}); + World.getInstance().setStartGrassDensity(new Integer(grassDensity.getText())); + World.getInstance().setStartNoWaterTiles(new Integer(no_water_tiles.getText())); + World.getInstance().setStartNoHerbivores(new Integer(no_herbivores.getText())); + World.getInstance().setStartNoCarnivores(new Integer(no_carnivores.getText())); + World.getInstance().setStartEnergyCarnivores(new Integer(energyCarnivores.getText())); + World.getInstance().setStartEnergyHerbivores(new Integer(energyHerbivores.getText())); + } +} diff --git a/README b/README new file mode 100755 index 0000000..7e39738 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +=================== + Ecologia README +=================== + +Ecologia is a graphical ecosystem simulator. Currently it is still very basic, +but hopefully it will soon be expanded to include more and more aspects of a +real ecosystem. + +It is written in Java, though no programming knowledge is needed to use it. +Requires Java 7 or higher to be installed. + + +Further documentation files can be found in the 'doc' subdirectory: + +help - A short manual +concepts - Introduction to the concepts of Ecologia +roadmap - Future development plans +TODO - List of things to be done (for developers) +bugs - List of known bugs (fixed and current) +javadoc.html - Complete Javadoc-tm documentation for Ecologia +Ecologia ODD.pdf - A description of the biological model behind + Ecologia using the ODD protocol (for biologists) + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You can find a copy of the license under doc/COPYING, or at + + +Copyright (C) 2014-2016 Daniel Vedder + + +Last modified 18/10/2016 + + diff --git a/analysis/demography/population.py b/analysis/demography/population.py new file mode 100755 index 0000000..9490f0f --- /dev/null +++ b/analysis/demography/population.py @@ -0,0 +1,220 @@ +#!/usr/bin/python3 +''' +This script takes an Ecologia log file as its input, extracts the population +levels at each update and outputs this as a .csv file which can then be converted +to .ods or further analysed with an R script. + +Written for Ecologia 1.0 + +@author Daniel Vedder +@date 6/4/2015 +''' + +import os +import sys + +global version +global update_count +global generation_count +global carnivore_count +global herbivore_count +global kill_rate +global grass_density +global src_file +global out_file + +version = "0.3" + + +''' +Load the Ecologia log file, extracting the interesting lines. +''' +def load_log(): + global src_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + try: + log_file = open(src_file, "r") + line = log_file.readline() + while line: + if "Executing update" in line: + next_count = line[line.find("Executing update ")+17:-1] + update_count.append(int(next_count)) + elif "Herbivore count" in line: + next_count = line[line.find("Herbivore count: ")+17:-1] + herbivore_count.append(int(next_count)) + elif "Carnivore count" in line: + next_count = line[line.find("Carnivore count: ")+17:-1] + carnivore_count.append(int(next_count)) + elif "Carnivore hunt success rate: " in line: + next_count = line[line.find("rate: ")+6:-2] + kill_rate.append(int(next_count)) + elif "Average grass density: " in line: + next_count = line[line.find("density: ")+9:-2] + grass_density.append(next_count) + elif "Generation counter: " in line: + next_count = line[line.find("counter: ")+9:-1] + generation_count.append(next_count) + line = log_file.readline() + log_file.close() + except IOError: + print("Reading file '"+src_file+"' failed!") + sys.exit() + +''' +If we have the data of long runs, we need to compact them or they won't fit onto +a single spreadsheet. (LibreOffice can only deal with ~1000 data points.) +''' +def compact(): + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + if len(update_count) < 1000: + return + new_update_count = [update_count[0]] + new_herbivore_count = [herbivore_count[0]] + new_carnivore_count = [carnivore_count[0]] + new_kill_rate = [kill_rate[0]] + new_grass_density = [grass_density[0]] + new_generation_count = [generation_count[0]] + for i in range(1, len(update_count)): + if (i+1)%10 == 0: + new_update_count.append(update_count[i]) + new_herbivore_count.append(herbivore_count[i]) + new_carnivore_count.append(carnivore_count[i]) + new_kill_rate.append(kill_rate[i]) + new_grass_density.append(grass_density[i]) + new_generation_count.append(generation_count[i]) + update_count = new_update_count + herbivore_count = new_herbivore_count + carnivore_count = new_carnivore_count + kill_rate = new_kill_rate + grass_density = new_grass_density + generation_count = new_generation_count + compact() #Keep going until the data set is small enough + +''' +Save the accumulated data to a .csv file +''' +def save_csv(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate all the data + data = "Updates" + for u in update_count: + data = data+","+str(u) + data = data+"\nHerbivores" + for h in herbivore_count: + data = data+","+str(h) + data = data+"\nCarnivores" + for c in carnivore_count: + data = data+","+str(c) + data = data+"\nKill rate" + for k in kill_rate: + data = data+","+str(k) + data = data+"\nGrass density" + for g in grass_density: + data = data+","+str(g) + data = data+"\nGenerations" + for n in generation_count: + data = data+","+str(n) + #Then write it to file + try: + csv_file = open(out_file, "w") + csv_file.write(data) + csv_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Save the data into a table (.txt) for R +''' +def save_table(): + global out_file + global update_count, generation_count + global herbivore_count, carnivore_count + global kill_rate, grass_density + #Accumulate the data + data = "Updates\tHerbivores\tCarnivores\tKillRate\tGrassDensity\tGenerations" + for i in range(len(update_count)): + data = data+"\n"+str(update_count[i])+"\t"+str(herbivore_count[i])+"\t"+str(carnivore_count[i]) + data = data+"\t"+str(kill_rate[i])+"\t"+str(grass_density[i])+"\t"+str(generation_count[i]) + #Then write it to file + try: + table_file = open(out_file, "w") + table_file.write(data) + table_file.close() + except IOError: + print("Writing "+out_file+" failed!") + sys.exit() + +''' +Print a help text +''' +def print_help(): + help_text = """Ecologia population tracker, version """+version+""" + +Commandline parameters: + --version -v Show the version number and exit + --help -h Show this help text and exit + + --logfile Use as the input logfile + --outfile Output to + --table Output data as a table (.txt) + --csv Output data as a csv file + --ods Convert the data to ods via csv + --compact Compact large data sets (automatic for ods)""" + print(help_text) + +def main(): + global src_file + global out_file + global update_count, generation_count + global carnivore_count, herbivore_count + global kill_rate, grass_density + src_file = "ecologia.log" + #Choose the right default output file name + if "--table" in sys.argv: out_file = "populations.txt" + elif "--csv" in sys.argv or "--ods" in sys.argv: out_file = "populations.csv" + else: raise Exception("Invalid file type specified!") + #Let the user override default options + if "--logfile" in sys.argv: + src_file = sys.argv[sys.argv.index("--logfile")+1] + if "--out-file" in sys.argv: + out_file = sys.argv[sys.argv.index("--out-file")+1] + #The chosen file ending determines the output type + if out_file[-4:] == ".txt": + sys.argv.append("--table") + elif out_file[-4:] == ".csv" or outfile[-4:] == ".ods": + sys.argv.append("--csv") + #XXX This might give a conflict with the section above + if "--table" in sys.argv and out_file[-4:] != ".txt": + out_file = out_file+".txt" + elif "--csv" in out_file[-4:] != ".csv": + out_file = out_file+".csv" + #Initialise variables + update_count, generation_count = [], [] + carnivore_count, herbivore_count = [], [] + kill_rate, grass_density = [], [] + #Do the actual work + load_log() + if "--compact" in sys.argv or "--ods" in sys.argv: compact() + if "--table" in sys.argv: save_table() + elif "--csv" in sys.argv or "--ods" in sys.argv: + save_csv() + if "--ods" in sys.argv: + os.system("libreoffice --headless --convert-to ods "+out_file) + +if __name__ == "__main__": + if "--version" in sys.argv or "-v" in sys.argv: + print("Ecologia population tracker, version "+version) + sys.exit() + elif "--help" in sys.argv or "-h" in sys.argv: + print_help() + sys.exit() + else: + main() diff --git a/analysis/demography/population.r b/analysis/demography/population.r new file mode 100755 index 0000000..8de2621 --- /dev/null +++ b/analysis/demography/population.r @@ -0,0 +1,48 @@ +# Create two line graphs depicting population change over time from Ecologia +# run data. (Requires a table file as created by population.py) +# +# version 0.1 +# (c) 2016 Daniel Vedder + +# The first plot uses linear axes for quantitative analyses. + +d = read.table("populations.txt", header=T, sep="\t") + +generations = d$Generations[length(d$Updates)] + +jpeg(filename="populations-absolute.jpg", width=1440, height=960, pointsize=16) + +par(mfrow=c(3, 1)) + +plot(d$Updates, d$Herbivores, type="l", main="Herbivore population development", + xlab="Updates", ylab="Population size", col="blue") + +plot(d$Updates, d$Carnivores, type="l", main="Carnivore population development", + xlab="Updates", ylab="Population size", col="red") + +plot(d$Updates, d$GrassDensity, type="l", main="Grass density development", + xlab="Updates", ylab="Average grass density per tile in %", col="green") + +dev.off() + +# The second plot shows all three data series on a single graph with a +# logarithmic y-axis for qualitative comparisons. + +jpeg(filename="populations-compare.jpg", width=1920, height=640, pointsize=20) + +#In the following I need to add 1 to each data series because log(0) is not defined + +plot(d$Updates, log(d$Herbivores+1), type="l", lwd=2, main=paste("Run over", generations, "generations"), + xlab="Updates", ylab="Logarithmic population density", yaxt="n", col="blue") + +par(new=T) + +plot(d$Updates, log(d$Carnivores+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, col="red") + +par(new=T) + +plot(d$Updates, log(d$GrassDensity+1), type="l", yaxt="n", ylab="", xlab="", + lwd=2, lty=3, col="green") + +dev.off() diff --git a/analysis/phylogeny/ecophyl-ui.lisp b/analysis/phylogeny/ecophyl-ui.lisp new file mode 100755 index 0000000..c40ca61 --- /dev/null +++ b/analysis/phylogeny/ecophyl-ui.lisp @@ -0,0 +1,16 @@ +#!/usr/bin/clisp +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enabling lines of descent to be studied. +;;;; This file provides a commandline user interface for the ecophyl package. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;; TODO + +;;; This is not currently high priority. The Ecophyl package can be +;;; used directly via a Common Lisp Read-Eval-Print Loop (REPL), for +;;; which any CLI would in effect be only a wrapper. The work needed +;;; to code the CLI can be put to better use elsewhere... diff --git a/analysis/phylogeny/ecophyl.lisp b/analysis/phylogeny/ecophyl.lisp new file mode 100755 index 0000000..99d7ae6 --- /dev/null +++ b/analysis/phylogeny/ecophyl.lisp @@ -0,0 +1,267 @@ +;;;; +;;;; ecophyl is a phylogenic analysis tool for Ecologia that keeps track of +;;;; every animal in a run and enables lines of descent to be studied. +;;;; This file contains the main Common Lisp package for ecophyl. +;;;; +;;;; Copyright (c) 2016 Daniel Vedder +;;;; Licensed under the terms of the GPLv3. +;;;; + +;;; ECOLOGIA VERSION 1.1 + +;;; Define the package + +(defpackage "ECOPHYL" + (:use "COMMON-LISP") + (:export "GET-ANIMAL" "ANALYSE-LOG" "SAVE-ANIMALS" "LOAD-ANIMALS" + "ANCESTORS" "OFFSPRING" "LCA" "LATEST-COMMON-ANCESTORS" + "ANIMAL" "GENOME" "*ANIMALS*")) + +(in-package "ECOPHYL") + + +;;; Define needed variables and structs + +(defstruct animal + (id 0) + (species NIL) + (parent 0) + (generation 0) + (offspring NIL) + (born 0) + (age -1) + (genome NIL)) + +(defstruct genome + (mutation-rate 0) + (speed 0) + (stamina 0) + (sight 0) + (metabolism 0) + (age-limit 0) + (strength 0) + (reproductive-energy 0) + (maturity-age 0) + (gestation 0) + (reproduction-rate 0)) + +;;Create the list of animals with a generic "ancestor" +(defvar *animals* (list (make-animal))) + + +;;; Ecologia-related functions +;; I/O functions + +(defun get-animal (id) + "Return the animal with this ID number" + (dolist (a *animals*) + (when (= (animal-id a) id) + (return a)))) + +(defun analyse-log (logfile) + "Read in a log file and extract all animal data" + ;;XXX This involves a lot of very precise string surgery. + ;; Any change in the log format (as regards analysis() calls) is + ;; likely to lead to breakage here! + ;;FIXME Try to remove the remaining 'surgery' bits + (do* ((log (load-text-file logfile)) (ln (length log)) + (i 0 (1+ i)) (line (nth i log) (if (= i ln) "" (nth i log))) + (words (split-string line #\space) (split-string line #\space))) + ((= i ln) (format t "~&Done.")) + (when (member "ANALYSIS:" words :test #'equalp) + (format t "~&Analysing line ~S." i) + (cond ((member "created" words :test #'equalp) + (let* ((parent (get-animal (get-property "parent" words))) + (id (get-property "ID")) + (a (make-animal :id id + :species (nth 5 words) + :parent (animal-id parent) + :generation (get-property "generation") + :born (get-property "update")))) + (setf *animals* (append *animals* (list a))) + (setf (animal-offspring parent) + (append (animal-offspring parent) (list id))))) + ((member "genome" words :test #'equalp) + (let ((id (read-from-string + (first (cut-string (nth 7 words) + (1- (length (nth 7 words))))))) + (g (make-genome + :age-limit (get-property "ageLimit" words) + :maturity-age (get-property "maturityAge") + :strength (get-property "strength") + :reproductive-energy (get-property "reproductiveEnergy") + :stamina (get-property "stamina") + :sight (get-property "sight") + :mutation-rate (get-property "mutationRate") + :metabolism (get-property "metabolism") + :reproduction-rate (get-property "reproductionRate") + :gestation (get-property "gestation") + :speed (get-property "speed")))) + (setf (animal-genome (get-animal id)) g))) + ((member "died" words :test #'equalp) + (let ((id (read-from-string (nth 5 words))) + (age (read-from-string (nth 9 words)))) + (setf (animal-age (get-animal id)) age))))))) + +(let ((plist)) + (defun get-property (prop &optional prop-list) + "Extract the value of prop from a list of strings of the form 'x=y'" + ;; A helper function for analyse-log + ;; The property list is cached for easier syntax/better performance + (if prop-list (setf plist prop-list) + (unless plist (error "get-property: No property list specified!"))) + (dolist (elt plist) + (let ((pv (split-string elt #\=))) + (when (equalp prop (first pv)) + (return-from get-property (read-from-string (second pv)))))))) + +(defun save-animals (filename) + "Save a list of animals to file" + (with-open-file (f filename :direction :output) + (format f "~S" *animals*))) + +(defun load-animals (filename) + "Load a list of animals previously saved to file" + (with-open-file (f filename) ;;XXX What if the file doesn't exist? + (setf *animals* (read f)))) + +;; Analysis functions + +(defun ancestors (id) + "Find the ancestors of the given animal" + (if (zerop id) NIL + (cons id (ancestors (animal-parent (get-animal id)))))) + +(defun offspring (id) + "Find all offspring of the given animal" + (let* ((animal (get-animal id)) (offspring (animal-offspring animal))) + (dolist (c (animal-offspring animal) offspring) + ;;XXX This doesn't order the list, but who cares + (setf offspring (append offspring (offspring c)))))) + +;; XXX This is *very* time intensive! +(defun latest-common-ancestors (alist) + "Find the latest common ancestors of a list of animals" + ;; More specifically, return the shortest list of animal IDs who + ;; together are ancestral to all inputed animals + (let ((mca (lca alist)) (next-list nil)) + (setf next-list + (remove-if #'(lambda (a) (member mca (ancestors a))) alist)) + (if (null next-list) (list mca) + (cons mca (latest-common-ancestors next-list))))) + +(defun lca (alist) + "Find the most frequent latest common ancestor of a list of animal IDs" + ;; This returns multiple values: the ID of the LCA and its frequency + (do ((ancestor-list (mapcar #'(lambda (x) (reverse (ancestors x))) alist)) + (mca -1) (freq 0) (next-mca -1) (next-freq 0) (i 0 (1+ i))) + ((or (null next-mca) (< next-freq freq)) (values mca freq)) + (multiple-value-setq (next-mca next-freq) + (most-common-element (nths i ancestor-list))) + (when (and (> next-freq freq) next-mca) + (setf mca next-mca freq next-freq)))) + +;;; Utility functions + +;; XXX Not all of these are going to be needed, I just copied them en bloc +;; from my standard util.lisp file... + +;; XXX Copy the whole util.lisp file here and use it as its own package? + +(defmacro cassoc (entry table &key (test #'eql)) + "Returns (car (cdr (assoc entry table)))" + `(car (cdr (assoc ,entry ,table :test ,test)))) + +(defun load-text-file (file-name) + "Load a text file into a list of strings (representing the lines)" + (with-open-file (f file-name) + (do* ((line (read-line f nil nil) + (read-line f nil nil)) + (file-lines (list line) (append file-lines (list line)))) + ((null line) file-lines)))) + +(defun string-from-list (lst &optional (separator " - ")) + "Put all elements of lst into a single string, separated by the separator" + (cond ((null lst) "") + ((= (length lst) 1) (to-string (car lst))) + (T (concatenate 'string (to-string (first lst)) (to-string separator) + (string-from-list (cdr lst) separator))))) + +(defun split-string (str separator) + "Split the string up into a list of strings along the separator character" + (cond ((equalp str (to-string separator)) NIL) + ((zerop (count-instances separator str)) (list str)) + (T (let ((split-elt (cut-string str (position separator str)))) + (cons (first split-elt) + (split-string (second (cut-string (second split-elt) 1)) + separator)))))) + +(defun cut-string (s i) + "Cut string s in two at index i and return the two substrings in a list" + (if (or (minusp i) (> i (length s))) s + (let ((s1 (make-string i)) (s2 (make-string (- (length s) i)))) + (dotimes (c (length s) (list s1 s2)) + (if (> i c) + (setf (aref s1 c) (aref s c)) + (setf (aref s2 (- c i)) (aref s c))))))) + +(defun char-list-to-string (char-list) + "Convert a character list to a string" + (let ((s (make-string (length char-list) :initial-element #\SPACE))) + (dotimes (i (length char-list) s) + (setf (aref s i) (nth i char-list))))) + +(defun trim-whitespace (s) + "Trim off spaces and tabs before and after string s" + (string-trim '(#\space #\tab) s)) + +(defun to-string (x) + "Whatever x is, convert it into a string" + (cond ((stringp x) x) + ((or (symbolp x) (characterp x)) (string x)) + (t (format NIL "~S" x)))) + +(defun extract-elements (str) + "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" + (multiple-value-bind (next-element i) (read-from-string str nil) + (if (null next-element) NIL + (cons next-element + (extract-elements (second (cut-string str i))))))) + +(defun count-instances (search-term search-sequence &key (test #'eql)) + "Count the number of instances of search-term in search-sequence" + (let ((count 0)) + (dotimes (i (length search-sequence) count) + (when (funcall test search-term (elt search-sequence i)) + (incf count))))) + +(defun most-common-element (lst &key (test #'eql)) + "Return the most common element in this list and how often it appears" + ;;This function has multiple return values! + ;;In case of multiple mces, return the one that appears first + (let ((elements-counted NIL) (max 0) (mce NIL)) + (dolist (e lst (values mce max)) + (unless (member e elements-counted :test test) + (let ((count (count-instances e lst :test test))) + (when (> count max) + (setf max count) + (setf mce e))) + (setf elements-counted (append elements-counted (list e))))))) + +(defun nths (n lst) + "Take in a list of lists and return the nth element of each" + (when (and lst (listp (car lst))) + (cons (nth n (car lst)) (nths n (cdr lst))))) + +(defun range (stop &key (start 0) (step 1)) + "Return a list of numbers from start to stop" + ;;XXX Surely this must exist as a function in Common Lisp already, + ;; I just don't know what it's called... + (unless (>= start stop) + (cons start (range stop :start (+ start step) :step step)))) + +;;; For acceptable performance during analysis, +;;; some functions need to be compiled +(dolist (fn '(analyse-log get-property split-string + cut-string count-instances)) + (compile fn)) diff --git a/doc/COPYING b/doc/COPYING new file mode 100755 index 0000000..4432540 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/doc/Ecologia ODD.pdf b/doc/Ecologia ODD.pdf new file mode 100755 index 0000000..478be47 --- /dev/null +++ b/doc/Ecologia ODD.pdf Binary files differ diff --git a/doc/ODD.odt b/doc/ODD.odt new file mode 100755 index 0000000..85a112c --- /dev/null +++ b/doc/ODD.odt Binary files differ diff --git a/doc/TODO b/doc/TODO new file mode 100755 index 0000000..674d425 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,55 @@ +ECOLOGIA TODO +============= + +for version 1.0: + +- change humidity label into a selection box x +- herbivore feeding behaviour x +- carnivore hunting behaviour x +- herbivore fleeing behaviour x +- "New run" functionality x +- graphical configuration windows + -> simulation x + -> genomes x + -> program x +- find & fix random freeze (Midwinter) bug x +- find & fix Springfrost (very random freezing) bug x +- documentation x +- help window x +- adjust genome values to ensure survival of species x +- improve grazing algorithm x +- find & fix 'flee center' bug x +- add analysis IO method x +- add --autorun option x +- add --timelapse option x +- finalize release system and documentation x + +for version 1.1: + +- systematic recording of runtime data [red] x +- config file parsing [red] x +- phylogeny analysis tool [orange] x +- add --no-gui option [green] x +- fix release system x +- update documentation x + +for later releases: + +- reading in an ascii map file to create the terrain [orange] +- manipulating animals at runtime [orange] +- saving the current state of a simulation to file and reloading it [orange] +- create an ANT build script / make file [yellow] +- implement caching for log I/O operations [yellow] +- commandline interface [green] +- CLI for ecophyl [green] +- add lock file [green] + + >> colours behind feature requests indicate urgency + +ideas for scenario branches: + +- walls +- disease +- seasons +- metapopulations +- Allee effect diff --git a/doc/bugs b/doc/bugs new file mode 100755 index 0000000..bc2c52f --- /dev/null +++ b/doc/bugs @@ -0,0 +1,95 @@ +ECOLOGIA - known bugs +===================== + +1. Random freezing - "Spring frost" + Description: apparently randomly, Ecologia will freeze up with excessive + CPU usage. Occurs approx. once every 5-10 runs at various updates. + Reproducing: not known + Error source: Most likely related to animal behaviour. Possible: + fleeing animal cannot move in any direction. + STATUS: FIXED + +2. Flee CENTER + Description: occasionally, a herbivore will attempt to move in the + direction CENTER when fleeing from a herbivore + Reproducing: not known + Error source: A carnivore ends up on the same tile as the herbivore in + question (how is that possible?) + - Answer: the carnivore is actually hunting another herbivore + and only happens to end up on the tile of this herbivore. + (The problem lies in the Animal class search algorithm.) + STATUS: FIXED + +2b. Move CENTER + Description: sometimes, herbivores try to move in the direction CENTER + even when not fleeing from a carnivore + Reproducing: happens almost every run + Error source: a missing check in the grazing method + STATUS: FIXED + +3. JAR file does not write log + Description: when the exported Ecologia JAR file is started graphically + by double-clicking it, it will not write any log files even if told + to do so via the 'Program Configuration' window. There is no problem + when launching from terminal. + Reproducing: as described above + Error source: This isn't a real bug at all - the only problem is that Java + takes the user's home directory as working directory when launching + the JAR file graphically. That means the log file ends up there. + STATUS: DROPPED + +4. Tiles in row 0 or column 0 not accessible? + Description: if you click on a tile in row 0 or column 0, InfoBox will not + pop up. + Reproducing: as described above + Error source: an off-by-one error in Display/InfoBox + STATUS: FIXED + +5. InfoBox confused? + Description: InfoBox showed that a tile is occupied by a carnivore in the + tile view, but showed the stats for a herbivore in the animal view. + The field above does not have any occupant, but the animal view + showed a carnivore present. (See lost+found/flee_center/log3 line + 1316) Simulation stopped, but without an error message. + Reproducing: not known + Error source: caused by the flee CENTER bug + STATUS: REDUNDANT + +6. JAR file can't read help file + Description: when launched from a packaged JAR file, Ecologia can never + display its help text. No problem when launching from Eclipse. + Reproducing: as above + Error source: something to do with where the help text is stored + STATUS: FIXED + +7. Carnivore attacks dead herbivore + Description: At irregular intervals, Ecologia stops the simulation + (without changing the "Stop/Start" button). The log shows that + a carnivore has just killed a herbivore, but then immediately + proceeds to attack a (the same?) herbivore again. + Reproducing: not known + Error source: Probably either in the dead-herbivore-removal-code or in the + carnivore-attack-code. Why Ecologia stops is still unclear. + STATUS: FIXED + +8. "Ghost bug" - Dead animals not removed from the display + Description: Occasionally, a dead animal will not be removed from + Simulator.map, leaving a "ghost" on the display. Sometimes + Carnivores attempt to attack phantom Herbivores, leading to + error messages. + Reproducing: during a longer run, look for carnivores that aren't moving. + Error source: Caused by an animal "dying twice" in one turn, e.g. during + movement, or when death by old age and starvation coincide. + STATUS: FIXED + +9. "Wall of death" - carnivores repeatedly drive herbivores extinct + Description: Carnivores drift towards the right world border early on + during a run. There they reproduce, eventually forming a line + across the entire width of the world. This wall then moves + left, killing all herbivores in its path. + Reproducing: Noticeable on virtually every run in which carnivores + don't die out straight away. + Error source: The search algorithm in the Animal class is too predictable. + Unfortunately, the algorithm that would fix this bug is a major + cause of the flee center bug... + STATUS: FIXED \ No newline at end of file diff --git a/doc/concepts b/doc/concepts new file mode 100755 index 0000000..ab04c17 --- /dev/null +++ b/doc/concepts @@ -0,0 +1,69 @@ +Ecologia Concepts +================= + + +UPDATES + +Time in Ecologia simulations is measured in updates. Each update, every tile is +updated and every animal gets its turn to move. How much physical time an update +requires depends on the speed setting (modifiable in the GUI) and the processing +power of the computer on which Ecologia is running. + + +TILES + +The Ecologia world consists of a tile matrix. Each tile represents one discrete +area of ground that can be occupied by at most one animal or a spring (water +tile). Grass grows on tiles, providing food for herbivores. Depending on the +humidity, the grass density may increase or decrease each turn. It also +decreases when herbivores feed on the tile. + +Tiles are colour-coded to show their current grass density: above 20%, the tile +is green. Between 0% and 20%, it is yellow; when there is no grass at all, the +tile is white. Herbivores cannot feed on tiles where the grass density is 0%. + + +HUMIDITY + +Each tile has a humidity value, which is a combination of global and local +factors. The global humidity settings may be changed in the GUI, possible values +are 'Saturation' (+2), 'Wet' (+1), 'Dry' (0), 'Drought' (-1) or 'Severe Drought' +(-2). This setting simulates rainfall. Local humidity may be affected by the +presence of water tiles (representing springs or oases). Each water tile waters +a 5x5 square around itself (i.e. sets the humidity in those squares to +'Saturation'). + + +ANIMALS + +Animals are the main focus of Ecologia. As of version 1.0, there are two +species: herbivores and carnivores. Herbivores feed on the grass that grows on +each tile; carnivores hunt and eat herbivores. All animals have an energy level, +when this reaches 0, the animal dies. Movement and reproduction requires energy, +feeding restores it. Reproduction takes place asexually, when the animal's +energy level exceeds a certain genetically determined mark. Animals die either +through losing all energy (for example in a drought) of old age (see the genome) +or (in the case of herbivores) by being killed in a fight with a carnivore. + + +GENOMES + +Each animal has a genome that determines certain core characteristics. At the +start of a simulation, a user-defined standard genome is given to all animals of +a species. At reproduction, the parent genome is passed on to the offspring, +potentially being mutated in the process. + +All genomes encode the following characteristics (values differ according to +species, but the 'genes' are always the same): + - mutation rate (percentage mutation probability per 'gene') + - speed of movement (in tiles per turn) + - stamina (used to simulate exhaustion caused by moving and fighting) + - range of eyesight (in tiles) + - efficiency of metabolism (this plays a role in how much energy + the animal gleans from its food) + - age limit (when reaching this age, the animal dies) + - strength (important when hunting/fighting) + - reproductive energy (the energy level at which it will reproduce) + - age of sexual maturity (at which it can start reproducing) + - gestation period (minimum time interval between reproduction events) + - rate of reproduction (number of offspring per reproduction event) diff --git a/doc/default.config b/doc/default.config new file mode 100755 index 0000000..e6f1fb9 --- /dev/null +++ b/doc/default.config @@ -0,0 +1,45 @@ +# +# This is the default Ecologia configuration file. Its values have +# been chosen to provide stable ecosystem dynamics when run. +# +# Daniel Vedder, 20/09/2016 +# + +[world] +width 100 +height 100 +timelapse 300 +stopAt 200 +waterTiles 10 +humidity 1 +startGrassDensity 100 +startCarnivores 50 +startHerbivores 200 +startEnergyCarnivores 150 +startEnergyHerbivores 100 + +[herbivore] +mutationRate 0 +speed 2 +stamina 10 +sight 4 +metabolism 10 +ageLimit 150 +strength 10 +reproductiveEnergy 120 +maturityAge 15 +gestation 10 +reproductionRate 2 + +[carnivore] +mutationRate 0 +speed 3 +stamina 10 +sight 4 +metabolism 18 +ageLimit 200 +strength 11 +reproductiveEnergy 200 +maturityAge 30 +gestation 10 +reproductionRate 1 diff --git a/doc/help b/doc/help new file mode 100755 index 0000000..ca30c42 --- /dev/null +++ b/doc/help @@ -0,0 +1,146 @@ +Ecologia Help +============== + +version 1.1 + + +COMPILING ECOLOGIA + +By default, Ecologia comes with a precompiled JAR file that you can run straight +away (see below). However, if you have tinkered with the Java source code, you +are going to have to recompile it yourself. This is done with the 'release.py' +script in the project home directory. + +release.py automates the release process, including compilation, packaging and +signing of the finished tar package. When called without arguments, it will run +the complete program. This can take a bit of time though, so while you are in +the process of developing, you will probably want to run it with the following +flags: + + 'python3 release.py --no-javadoc --no-sign' + +This leaves out two of the most time consuming steps. If for some reason you +wish to create a ZIP archive for redistribution (instead of the normal tar), +you can use the --zip flag. + +Please note that release.py will only work on Linux. + + +STARTING ECOLOGIA + +To start Ecologia, simply double-click on the executable JAR file (Java 7 or +higher is required). The following command (without the quotes) will launch +Ecologia from terminal on Linux: + + 'java -jar ecologia-1.1.jar' + +(Presuming you are using version 1.1, if not, replace with the appropriate +file name.) When launching from terminal, it is possible to use commandline +flags to control Ecologia's behaviour. (See below for details.) + + +COMMANDLINE FLAGS + +Ecologia accepts several commandline flags, as listed below: + +--help -h Print this help text +--version -V Print the version number + +--logging -l Enable logging to file +--verbose -v Give verbose output +--debug -d Print debugging information +--analyse -a Print simulation analysis information + +--no-graphics Do not start the GUI (requires --autorun) + +--config Specify a configuration file to use +--autorun Autorun the simulation for n updates, then quit +--timelapse Set the timelapse between updates + +Note that most of these (except --autorun and --no-graphics) can also be +accessed from the GUI. + +Warning: setting --debug and/or --analyse produces very large log files +(in the megabyte range) and can potentially reduce performance due to frequent +disk I/O operations. Use sparingly. + + +THE MAIN WINDOW + +The largest part of the main window consists of the map display (a large area +filled with squares). Each square represents one ground tile, colour coded to +show the grass density on this field: green > 20%, yellow <= 20%, white 0%. +Blue squares are water tiles, grey circles herbivores and red circles +carnivores. Clicking on one tile will bring up an information box about this +tile and the animal (if any) on it. + +On the right is an information and control panel. Its uppermost part displays +the update and generation counters as well as a counter for the number of +currently living herbivores and carnivores. This is followed by the run-time +protocol, which displays basic simulation events. (More extensive logging to +file is possible with the --logging option, see above). + +Below this are basic controls: a humidity setter, a Start/Stop button (run/pause +the simulation), a 'Next' button (advance the simulation by one update), a speed +slider to control the simulation speed, a 'Pause at update' text box +(simulation will pause automatically when this update number has been reached) +and finally a 'Freeze display' checkbox (which stops the display from being +updated, thus saving some computing resources). + +Via the menu you can start a new simulation, configure your setup or view more +information about Ecologia. + + +CONFIGURATION + +The 'Configuration' menu entry gives access to three different configuration +windows. Under 'Ecologia', you can graphically set the switches that are usually +controlled via the commandline flags; namely verbosity, logging, analysis and +debugging output (see above). 'Simulation' lets you modify global variables +related to the simulation run, such as the world size or the number of water +tiles. 'Genome' configures the initial genomes which are used when creating +the animal populations. + +Ecologia also accepts configuration files of a format similar to Microsoft's +INI files. A config file may be loaded from the GUI (in the menu: Configuration +-> Configuration file) or specified using a commandline option (see above). + +An example config file can be found under 'doc/default.config'. As can be seen +from this example, the file is split into three sections ('[world]', +'[herbivore]' and '[carnivore]'), each of which contain several variables. +The world section is responsible for global parameters while the other two +sections represent the initial genomes of the two species. Parameter +declarations consist of the name of the variable, followed by a space and its +integer value. Lines beginning with a '#' character are ignored by the parser. +All possible parameters (excepting 'autorun') are listed in the default config +file. If a parameter is not present in a config file, it is set to its default +value as specified in the source code. + + +DATA ANALYSIS + +When logging is turned on (see above), Ecologia will generate a logfile with +error messages and, depending on the settings, simulation logs and debugging +information. Part of the simulation logs are population statistics that are +saved every update. + +Using the 'population.py' script in the 'analysis/demography' folder, it is +possible to extract these statistics and compile them into a csv or txt file +or an OpenDocument spreadsheet (if LibreOffice is installed) for further +analysis. To do so, run the script from terminal. ('population.py --help' +prints out a list of options.) + +The 'population.r' script in the same folder will take a text file outputted +by the Python script and generate population development graphs from the data. + +In the 'analysis/phylogeny' folder you will find 'ecophyl.lisp'. This is a +Common Lisp library that can create a complete phylogeny from an Ecologia log +file, if the --analysis flag was set. With it, you can view any individual's +life stats as well as their ancestors and offspring, or compute the latest +common ancestor of a group of animals. Unfortunately, there is not yet any +direct user interface available for this library, so it has to be used via a +Common Lisp read-eval-print loop (REPL). Ecophyl was developed using the CLISP +interpreter, but should be usable with any other ANSI-compliant interpreter. + + +Last modified 18/10/2016 diff --git a/doc/javadoc.html b/doc/javadoc.html new file mode 120000 index 0000000..fbc70e9 --- /dev/null +++ b/doc/javadoc.html @@ -0,0 +1 @@ +javadoc/index.html \ No newline at end of file diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100755 index 0000000..ffc546e --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100755 index 0000000..7bf98ea --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,38 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100755 index 0000000..6b81bef --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,238 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Constant Field Values

+

Contents

+ +
+
+ + +

main.*

+ + + + +

model.*

+ + + + +

view.*

+
    +
  • + + + + + + + + + + + + + + +
    view.GUI 
    Modifier and TypeConstant FieldValue
    + +private static final longserialVersionUID4727895060816956404L
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/Humidity.html b/doc/javadoc/controller/Humidity.html new file mode 100755 index 0000000..bfa0b61 --- /dev/null +++ b/doc/javadoc/controller/Humidity.html @@ -0,0 +1,448 @@ + + + + + +Humidity + + + + + + + + + + + + +
+
controller
+

Enum Humidity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Humidity>
    • +
    • +
        +
      • controller.Humidity
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Humidity>
    +
    +
    +
    +
    public enum Humidity
    +extends java.lang.Enum<Humidity>
    +
    The different levels of humidity that are available.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HumidityfromString(java.lang.String value) +
      Convert an integer into an enum entry
      +
      static HumiditygetStatus(int value) +
      Convert a number into an enum entry.
      +
      java.lang.StringgetString() +
      Return the string representation of an entry.
      +
      intgetValue() +
      Return the numerical value of an entry.
      +
      static HumidityvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        SEVERE_DROUGHT

        +
        public static final Humidity SEVERE_DROUGHT
        +
      • +
      + + + +
        +
      • +

        DROUGHT

        +
        public static final Humidity DROUGHT
        +
      • +
      + + + +
        +
      • +

        DRY

        +
        public static final Humidity DRY
        +
      • +
      + + + +
        +
      • +

        WET

        +
        public static final Humidity WET
        +
      • +
      + + + +
        +
      • +

        SATURATION

        +
        public static final Humidity SATURATION
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Humidity[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Humidity c : Humidity.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Humidity valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        public int getValue()
        +
        Return the numerical value of an entry.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return the string representation of an entry.
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static Humidity fromString(java.lang.String value)
        +
        Convert an integer into an enum entry
        +
      • +
      + + + +
        +
      • +

        getStatus

        +
        public static Humidity getStatus(int value)
        +
        Convert a number into an enum entry.
        +
        +
        Parameters:
        +
        int - value
        +
        Returns:
        +
        Humidity
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/OccupantType.html b/doc/javadoc/controller/OccupantType.html new file mode 100755 index 0000000..d9dde89 --- /dev/null +++ b/doc/javadoc/controller/OccupantType.html @@ -0,0 +1,434 @@ + + + + + +OccupantType + + + + + + + + + + + + +
+
controller
+

Enum OccupantType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<OccupantType>
    • +
    • +
        +
      • controller.OccupantType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<OccupantType>
    +
    +
    +
    +
    public enum OccupantType
    +extends java.lang.Enum<OccupantType>
    +
    This is a list of all the possible elements that can occupy a field.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static OccupantTypefromInt(int i) +
      Convert the corresponding enum entry for this integer
      +
      static OccupantTypefromString(java.lang.String s) +
      Transform a string into an occupant type
      +
      inttoInt() +
      Convert an enum entry to an integer
      +
      java.lang.StringtoString() +
      Return the string representation of an entry.
      +
      static OccupantTypevalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static OccupantType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (OccupantType c : OccupantType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static OccupantType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        toInt

        +
        public int toInt()
        +
        Convert an enum entry to an integer
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static OccupantType fromInt(int i)
        +
        Convert the corresponding enum entry for this integer
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Return the string representation of an entry.
        +
        +
        Overrides:
        +
        toString in class java.lang.Enum<OccupantType>
        +
        +
      • +
      + + + +
        +
      • +

        fromString

        +
        public static OccupantType fromString(java.lang.String s)
        +
        Transform a string into an occupant type
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/World.html b/doc/javadoc/controller/World.html new file mode 100755 index 0000000..a0ee047 --- /dev/null +++ b/doc/javadoc/controller/World.html @@ -0,0 +1,1224 @@ + + + + + +World + + + + + + + + + + + + +
+
controller
+

Class World

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • controller.World
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class World
    +extends java.lang.Object
    +
    The World class acts as a communicator between the model and the view packages. It receives + the current status of the simulation from model and passes it on to view. Conversely, user + input from view is forwarded to model. It also stores all simulation settings.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        world

        +
        private static World world
        +
      • +
      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        timelapse

        +
        private int timelapse
        +
      • +
      + + + +
        +
      • +

        stopAt

        +
        private int stopAt
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private int autorun
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private Humidity humidity
        +
      • +
      + + + +
        +
      • +

        startGrassDensity

        +
        private int startGrassDensity
        +
      • +
      + + + +
        +
      • +

        waterTiles

        +
        private int waterTiles
        +
      • +
      + + + +
        +
      • +

        startNoCarnivores

        +
        private int startNoCarnivores
        +
      • +
      + + + +
        +
      • +

        startNoHerbivores

        +
        private int startNoHerbivores
        +
      • +
      + + + +
        +
      • +

        startEnergyCarnivores

        +
        private int startEnergyCarnivores
        +
      • +
      + + + +
        +
      • +

        startEnergyHerbivores

        +
        private int startEnergyHerbivores
        +
      • +
      + + + +
        +
      • +

        running

        +
        private boolean running
        +
      • +
      + + + +
        +
      • +

        turn

        +
        private int turn
        +
      • +
      + + + +
        +
      • +

        nextID

        +
        private int nextID
        +
      • +
      + + + +
        +
      • +

        herbivoreCounter

        +
        private int herbivoreCounter
        +
      • +
      + + + +
        +
      • +

        carnivoreCounter

        +
        private int carnivoreCounter
        +
      • +
      + + + +
        +
      • +

        highestGeneration

        +
        private int highestGeneration
        +
      • +
      + + + +
        +
      • +

        averageGrassDensity

        +
        private int averageGrassDensity
        +
      • +
      + + + +
        +
      • +

        animals

        +
        private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
        +
      • +
      + + + +
        +
      • +

        news

        +
        private java.util.ArrayList<java.lang.String> news
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        World

        +
        private World()
        +
        This class implements Singleton, therefore the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getInstance

        +
        public static World getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        readConfigFile

        +
        public void readConfigFile(java.lang.String filename)
        +
        Read and parse a config file. + XXX This is really messy, but it works.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the world run-time variables, ready for a new run. + This method should only be called from the Ecologia main class!
        +
      • +
      + + + +
        +
      • +

        giveNews

        +
        public void giveNews(java.lang.String message)
        +
        Display a news item - calling with null as a parameter resets the news list
        +
        +
        Parameters:
        +
        news -
        +
        +
      • +
      + + + +
        +
      • +

        getAnimalInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if no animal at the specified location
        +
        +
      • +
      + + + +
        +
      • +

        getFieldInfo

        +
        public 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
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        HashMap, or null if out of bounds
        +
        +
      • +
      + + + +
        +
      • +

        getDefaultGenome

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
        +
        Return a hash map holding all the genome values
        +
      • +
      + + + +
        +
      • +

        setDefaultGenome

        +
        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)
        +
        Interface for the Genome method
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int[] getSize()
        +
      • +
      + + + +
        +
      • +

        setSize

        +
        public void setSize(int[] size)
        +
      • +
      + + + +
        +
      • +

        getTimelapse

        +
        public int getTimelapse()
        +
      • +
      + + + +
        +
      • +

        setTimelapse

        +
        public void setTimelapse(int timelapse)
        +
      • +
      + + + +
        +
      • +

        getStopAt

        +
        public int getStopAt()
        +
      • +
      + + + +
        +
      • +

        setStopAt

        +
        public void setStopAt(int stopAt)
        +
      • +
      + + + +
        +
      • +

        getAutorun

        +
        public int getAutorun()
        +
      • +
      + + + +
        +
      • +

        setAutorun

        +
        public void setAutorun(int autorun)
        +
      • +
      + + + +
        +
      • +

        getHumidity

        +
        public Humidity getHumidity()
        +
      • +
      + + + +
        +
      • +

        setHumidity

        +
        public void setHumidity(Humidity humidity)
        +
      • +
      + + + +
        +
      • +

        getStartGrassDensity

        +
        public int getStartGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setStartGrassDensity

        +
        public void setStartGrassDensity(int startGrassDensity)
        +
      • +
      + + + +
        +
      • +

        getWaterTiles

        +
        public int getWaterTiles()
        +
      • +
      + + + +
        +
      • +

        setStartNoWaterTiles

        +
        public void setStartNoWaterTiles(int startNoWaterTiles)
        +
      • +
      + + + +
        +
      • +

        getStartNoCarnivores

        +
        public int getStartNoCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoCarnivores

        +
        public void setStartNoCarnivores(int startNoCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartNoHerbivores

        +
        public int getStartNoHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartNoHerbivores

        +
        public void setStartNoHerbivores(int startNoHerbivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyCarnivores

        +
        public int getStartEnergyCarnivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyCarnivores

        +
        public void setStartEnergyCarnivores(int startEnergyCarnivores)
        +
      • +
      + + + +
        +
      • +

        getStartEnergyHerbivores

        +
        public int getStartEnergyHerbivores()
        +
      • +
      + + + +
        +
      • +

        setStartEnergyHerbivores

        +
        public void setStartEnergyHerbivores(int startEnergyHerbivores)
        +
      • +
      + + + +
        +
      • +

        getHerbivoreCount

        +
        public int getHerbivoreCount()
        +
      • +
      + + + +
        +
      • +

        setHerbivoreCount

        +
        public void setHerbivoreCount(int herbivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getCarnivoreCount

        +
        public int getCarnivoreCount()
        +
      • +
      + + + +
        +
      • +

        setCarnivoreCount

        +
        public void setCarnivoreCount(int carnivoreCounter)
        +
      • +
      + + + +
        +
      • +

        getAverageGrassDensity

        +
        public int getAverageGrassDensity()
        +
      • +
      + + + +
        +
      • +

        setAverageGrassDensity

        +
        public void setAverageGrassDensity(int averageGrassDensity)
        +
      • +
      + + + +
        +
      • +

        isRunning

        +
        public boolean isRunning()
        +
      • +
      + + + +
        +
      • +

        setRunning

        +
        public void setRunning(boolean running)
        +
      • +
      + + + +
        +
      • +

        getTurn

        +
        public int getTurn()
        +
      • +
      + + + +
        +
      • +

        incrementTurn

        +
        public void incrementTurn()
        +
        Increment the turn variable by one.
        +
      • +
      + + + +
        +
      • +

        getNextID

        +
        public int getNextID()
        +
        Get the next unique animal ID number and increment the counter.
        +
      • +
      + + + +
        +
      • +

        incGeneration

        +
        public void incGeneration(int n)
        +
        Increment the generation counter as necessary.
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        setAnimals

        +
        public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
        +
      • +
      + + + +
        +
      • +

        collectNews

        +
        public java.util.ArrayList<java.lang.String> collectNews()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/controller/package-frame.html b/doc/javadoc/controller/package-frame.html new file mode 100755 index 0000000..d03ada5 --- /dev/null +++ b/doc/javadoc/controller/package-frame.html @@ -0,0 +1,25 @@ + + + + + +controller + + + + + +

controller

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/controller/package-summary.html b/doc/javadoc/controller/package-summary.html new file mode 100755 index 0000000..10571c9 --- /dev/null +++ b/doc/javadoc/controller/package-summary.html @@ -0,0 +1,177 @@ + + + + + +controller + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package controller

+
+
controller handles all communication between model and view.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    World +
    The World class acts as a communicator between the model and the view packages.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Humidity +
    The different levels of humidity that are available.
    +
    OccupantType +
    This is a list of all the possible elements that can occupy a field.
    +
    +
  • +
+ + + +

Package controller Description

+
controller handles all communication between model and view. + It stores a current snapshot of the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/controller/package-tree.html b/doc/javadoc/controller/package-tree.html new file mode 100755 index 0000000..0c20763 --- /dev/null +++ b/doc/javadoc/controller/package-tree.html @@ -0,0 +1,150 @@ + + + + + +controller Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package controller

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100755 index 0000000..d0c49fa --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,124 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100755 index 0000000..16b9cd9 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,225 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index-all.html b/doc/javadoc/index-all.html new file mode 100755 index 0000000..deea5f7 --- /dev/null +++ b/doc/javadoc/index-all.html @@ -0,0 +1,1467 @@ + + + + + +Index + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
A B C D E F G H I L M N O P R S T U V W X Y  + + +

A

+
+
about - Variable in class view.GUI
+
 
+
addAnimal(Animal) - Static method in class model.Simulator
+
+
Add an animal to the population
+
+
addDisplay() - Method in class view.GUI
+
+
Add the actual display.
+
+
addInformationPanel() - Method in class view.GUI
+
+
Add the information panel at the side
+
+
age - Variable in class model.Animal
+
 
+
age - Variable in class view.InfoBox
+
 
+
age_limit - Variable in class view.InfoBox
+
 
+
ageLimit - Variable in class model.Genome
+
 
+
ageLimit - Variable in class view.GenomeConfig
+
 
+
analyse - Variable in class view.ProgramConfig
+
 
+
analysing - Static variable in class main.EcologiaIO
+
 
+
analysis(String) - Static method in class main.EcologiaIO
+
+
Print an analysis message if the analysing flag is set.
+
+
Animal - Class in model
+
+
This is the superclass of all animal classes.
+
+
Animal(int, OccupantType, Genome, int, int, int, int, int) - Constructor for class model.Animal
+
+
The constructor.
+
+
animal_box - Variable in class view.InfoBox
+
 
+
animalInfo - Variable in class view.InfoBox
+
 
+
animals - Variable in class controller.World
+
 
+
apply - Variable in class view.ProgramConfig
+
 
+
archiveLog() - Static method in class main.EcologiaIO
+
+
Archive the current log file, ready for a new run
+
+
asHashMap() - Method in class model.Genome
+
+
Return all the "genes" of this genome in a single HashMap.
+
+
attack() - Method in class model.Carnivore
+
+
The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
+
+
attemptedMovesThisTurn - Variable in class model.Animal
+
 
+
autorun - Variable in class controller.World
+
 
+
autorun() - Method in class main.Ecologia
+
+
Perform an automatic run.
+
+
averageGrassDensity - Variable in class controller.World
+
 
+
+ + + +

B

+
+
BREAK_ERROR - Static variable in class main.EcologiaIO
+
 
+
button_panel - Variable in class view.HelpWindow
+
 
+
+ + + +

C

+
+
calculateGrassDensity() - Method in class model.MapField
+
+
Recalculate the grass density based on humidity values.
+
+
Carnivore - Class in model
+
+
This class simulates a carnivore.
+
+
Carnivore(int, Genome, int, int, int, int, int) - Constructor for class model.Carnivore
+
+
The constructor.
+
+
carnivore_counter - Variable in class view.GUI
+
 
+
carnivoreCounter - Variable in class controller.World
+
 
+
carnivoreGenome - Static variable in class model.Genome
+
 
+
carnivorePopulation - Static variable in class model.Simulator
+
 
+
changeEnergy(int) - Method in class model.Animal
+
+
Change the energy level of this animal.
+
+
checkGenome() - Method in class model.Genome
+
+
Check to make sure that no "gene" has a value below zero
+
+
closestSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
collectNews() - Method in class controller.World
+
 
+
concepts - Variable in class view.HelpWindow
+
 
+
configChooser - Variable in class view.GUI
+
 
+
configFileDialog - Variable in class view.GUI
+
 
+
configuration - Variable in class view.GUI
+
 
+
confirm - Variable in class view.GenomeConfig
+
 
+
confirm - Variable in class view.SimulationConfig
+
 
+
CONTINUABLE_ERROR - Static variable in class main.EcologiaIO
+
 
+
controller - package controller
+
+
controller handles all communication between model and view.
+
+
coordinates - Variable in class view.InfoBox
+
 
+
createGUI() - Method in class view.HelpWindow
+
+
Add the text area which will display the text and the buttons to choose + which text to display.
+
+
createMenu() - Method in class view.GUI
+
+
Add the menubar
+
+
currentDirection - Variable in class model.Carnivore
+
 
+
+ + + +

D

+
+
debug(String) - Static method in class main.EcologiaIO
+
+
Print a debug message if the debug flag is set.
+
+
debug - Variable in class view.ProgramConfig
+
 
+
debugging - Static variable in class main.EcologiaIO
+
 
+
DEFAULT_MUTATION_RATE - Variable in class model.Genome
+
 
+
defaultGenome - Static variable in class model.Carnivore
+
 
+
defaultGenome - Static variable in class model.Herbivore
+
 
+
dimensions - Variable in class view.SimulationConfig
+
 
+
Direction - Enum in model
+
+
A list of directions and common methods related to them + is often needed by animals.
+
+
Direction() - Constructor for enum model.Direction
+
 
+
disableDisplay - Variable in class view.GUI
+
 
+
Display - Class in view
+
+
This class provides a graphical representation of the simulation.
+
+
Display(int[]) - Constructor for class view.Display
+
+
The constructor
+
+
display - Variable in class view.GUI
+
 
+
displayNews() - Method in class view.GUI
+
+
Display news items on the ticker
+
+
drawAnimalBox() - Method in class view.InfoBox
+
+
Draw the animal box.
+
+
drawConfigWindow() - Method in class view.ProgramConfig
+
 
+
drawConfigWindow() - Method in class view.SimulationConfig
+
+
Create the interface
+
+
drawGenomeConfigWindow() - Method in class view.GenomeConfig
+
+
Create the interface
+
+
drawInfoBox() - Method in class view.InfoBox
+
+
Initialise the infobox.
+
+
drawTileBox() - Method in class view.InfoBox
+
+
Draw the tile box.
+
+
+ + + +

E

+
+
eco - Static variable in class main.Ecologia
+
 
+
Ecologia - Class in main
+
+
Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
+
+
Ecologia() - Constructor for class main.Ecologia
+
+
Ecologia implements Singleton, so the constructor is private.
+
+
EcologiaIO - Class in main
+
+
This class provides unified I/O methods for debugging, + logging, error messages, etc.
+
+
EcologiaIO() - Constructor for class main.EcologiaIO
+
 
+
EcoTest - Class in main
+
+
This class is used to test new features in Ecologia during development.
+
+
EcoTest() - Constructor for class main.EcoTest
+
 
+
efficiency - Variable in class view.InfoBox
+
 
+
energy - Variable in class model.Animal
+
 
+
energy - Variable in class view.InfoBox
+
 
+
energyCarnivores - Variable in class view.SimulationConfig
+
 
+
energyCarnLabel - Variable in class view.SimulationConfig
+
 
+
energyHerbivores - Variable in class view.SimulationConfig
+
 
+
energyHerbLabel - Variable in class view.SimulationConfig
+
 
+
error(String) - Static method in class main.EcologiaIO
+
+
Print an error message
+
+
error(String, Exception) - Static method in class main.EcologiaIO
+
+
Print an error message and the stack trace
+
+
error(String, int) - Static method in class main.EcologiaIO
+
+
Give an error message and pause/shut down
+
+
exhaust(int) - Method in class model.Animal
+
 
+
exhaustion - Variable in class model.Animal
+
 
+
exit - Variable in class view.GUI
+
 
+
eyesight - Variable in class view.InfoBox
+
 
+
+ + + +

F

+
+
FATAL_ERROR - Static variable in class main.EcologiaIO
+
 
+
feed() - Method in class model.Herbivore
+
+
Graze the current tile.
+
+
fights_won - Static variable in class model.Carnivore
+
 
+
file - Variable in class view.GUI
+
 
+
flee() - Method in class model.Herbivore
+
+
Run away from a predator
+
+
fromInt(int) - Static method in enum controller.OccupantType
+
+
Convert the corresponding enum entry for this integer
+
+
fromInt(int) - Static method in enum model.Direction
+
+
Return the direction that this number refers to.
+
+
fromString(String) - Static method in enum controller.Humidity
+
+
Convert an integer into an enum entry
+
+
fromString(String) - Static method in enum controller.OccupantType
+
+
Transform a string into an occupant type
+
+
+ + + +

G

+
+
generation - Variable in class model.Animal
+
 
+
generation - Variable in class view.InfoBox
+
 
+
generation_counter - Variable in class view.GUI
+
 
+
genome - Variable in class model.Animal
+
 
+
Genome - Class in model
+
+
A genome holds a number of variables ("genes") that determine an animals characteristics.
+
+
Genome() - Constructor for class model.Genome
+
+
The default constructor provides a standard genome.
+
+
Genome(Genome) - Constructor for class model.Genome
+
+
This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
+
+
Genome(int, int, int, int, int, int, int, int, int, int, int) - Constructor for class model.Genome
+
+
This constructor creates a genome from the values passed to it.
+
+
Genome(HashMap<String, Integer>) - Constructor for class model.Genome
+
+
This constructor creates a genome from a HashMap.
+
+
GenomeConfig - Class in view
+
+
This class provides GUI configuration facilities + for setting default genome values.
+
+
GenomeConfig() - Constructor for class view.GenomeConfig
+
+
The constructor
+
+
genomeConfig - Variable in class view.GUI
+
 
+
genomeConfigBox - Variable in class view.GUI
+
 
+
gestation - Variable in class model.Genome
+
 
+
gestation - Variable in class view.GenomeConfig
+
 
+
gestation - Variable in class view.InfoBox
+
 
+
gestationPeriod - Variable in class model.Animal
+
 
+
getAge() - Method in class model.Animal
+
 
+
getAgeLimit() - Method in class model.Genome
+
 
+
getAnimal(int, int) - Static method in class model.Simulator
+
+
Return the animal at (x, y), or null if there is no animal at that field.
+
+
getAnimalInfo(int, int) - Method in class controller.World
+
+
Return information about the animal at the given position as a hash map
+
+
getAutorun() - Method in class controller.World
+
 
+
getAverageGrassDensity() - Method in class controller.World
+
 
+
getCarnivore(int, int) - Static method in class model.Simulator
+
+
Return the carnivore at (x, y), or null if there is no animal at that field.
+
+
getCarnivoreCount() - Method in class controller.World
+
 
+
getDate() - Static method in class main.EcologiaIO
+
 
+
getDefaultGenome(OccupantType) - Method in class controller.World
+
+
Return a hash map holding all the genome values
+
+
getDirection(int, int) - Method in class model.Animal
+
+
In which direction are the given coordinates relative to this animal?
+
+
getDistance(int, int) - Method in class model.Animal
+
+
How many steps are needed to get to the specified position?
+
+
getEnergy() - Method in class model.Animal
+
 
+
getField(int, int) - Static method in class model.Simulator
+
+
Returns the field at the required position.
+
+
getFieldInfo(int, int) - Method in class controller.World
+
+
Return information about the map field at the given position as a hash map
+
+
getGeneration() - Method in class controller.World
+
 
+
getGeneration() - Method in class model.Animal
+
 
+
getGenome() - Method in class model.Animal
+
 
+
getGestation() - Method in class model.Genome
+
 
+
getGrassDensity() - Method in class model.MapField
+
 
+
getHerbivore(int, int) - Static method in class model.Simulator
+
+
Return the herbivore at (x, y), or null if there is no animal at that field.
+
+
getHerbivoreCount() - Method in class controller.World
+
 
+
getHumidity() - Method in class controller.World
+
 
+
getID() - Method in class model.Animal
+
 
+
getInfo() - Method in class model.Animal
+
+
Return a hash map containing all the information about this animal.
+
+
getInfo() - Method in class model.MapField
+
+
Return a hash map containing all the information about this field.
+
+
getInfoBox() - Method in class view.Display
+
+
Return the current infobox instance
+
+
getInstance() - Static method in class controller.World
+
+
The Singleton method.
+
+
getInstance() - Static method in class main.Ecologia
+
+
The Singleton method.
+
+
getLocalHumidity() - Method in class model.MapField
+
 
+
getMaturityAge() - Method in class model.Genome
+
 
+
getMetabolism() - Method in class model.Genome
+
 
+
getMutationRate() - Method in class model.Genome
+
 
+
getNeighbouringField(Direction) - Method in class model.Animal
+
+
Calculate the neighbouring square in the specified direction + (return null if out of bounds)
+
+
getNextID() - Method in class controller.World
+
+
Get the next unique animal ID number and increment the counter.
+
+
getOccupant() - Method in class model.MapField
+
 
+
getOffspring() - Method in class model.Animal
+
 
+
getParent() - Method in class model.Animal
+
 
+
getPreferredScrollableViewportSize() - Method in class view.Display
+
 
+
getReproductionRate() - Method in class model.Genome
+
 
+
getReproductiveEnergy() - Method in class model.Genome
+
 
+
getScrollableBlockIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getScrollableTracksViewportHeight() - Method in class view.Display
+
 
+
getScrollableTracksViewportWidth() - Method in class view.Display
+
 
+
getScrollableUnitIncrement(Rectangle, int, int) - Method in class view.Display
+
 
+
getSight() - Method in class model.Genome
+
 
+
getSize() - Method in class controller.World
+
 
+
getSpeed() - Method in class model.Genome
+
 
+
getStamina() - Method in class model.Genome
+
 
+
getStartEnergyCarnivores() - Method in class controller.World
+
 
+
getStartEnergyHerbivores() - Method in class controller.World
+
 
+
getStartGrassDensity() - Method in class controller.World
+
 
+
getStartNoCarnivores() - Method in class controller.World
+
 
+
getStartNoHerbivores() - Method in class controller.World
+
 
+
getStatus(int) - Static method in enum controller.Humidity
+
+
Convert a number into an enum entry.
+
+
getStopAt() - Method in class controller.World
+
 
+
getStrength() - Method in class model.Genome
+
 
+
getString() - Method in enum controller.Humidity
+
+
Return the string representation of an entry.
+
+
getString() - Method in enum model.Direction
+
+
Return a string representation of this direction.
+
+
getTimelapse() - Method in class controller.World
+
 
+
getTurn() - Method in class controller.World
+
 
+
getType() - Method in class model.Animal
+
 
+
getValue() - Method in enum controller.Humidity
+
+
Return the numerical value of an entry.
+
+
getWaterTiles() - Method in class controller.World
+
 
+
getX() - Method in class model.Animal
+
 
+
getY() - Method in class model.Animal
+
 
+
giveNews(String) - Method in class controller.World
+
+
Display a news item - calling with null as a parameter resets the news list
+
+
grass_counter - Variable in class view.GUI
+
 
+
grassDensity - Variable in class model.MapField
+
 
+
grassDensity - Variable in class view.SimulationConfig
+
 
+
grassLabel - Variable in class view.SimulationConfig
+
 
+
grasslevel - Variable in class view.InfoBox
+
 
+
gui - Variable in class main.Ecologia
+
 
+
GUI - Class in view
+
+
This class is the main class of the view package.
+
+
GUI() - Constructor for class view.GUI
+
+
The constructor.
+
+
+ + + +

H

+
+
heading - Variable in class view.ProgramConfig
+
 
+
heading - Variable in class view.SimulationConfig
+
 
+
height - Variable in class view.SimulationConfig
+
 
+
help - Variable in class view.GUI
+
 
+
help - Variable in class view.HelpWindow
+
 
+
help_menu - Variable in class view.GUI
+
 
+
helpWindow - Variable in class view.GUI
+
 
+
HelpWindow - Class in view
+
+
This window displays the help file for Ecologia.
+
+
HelpWindow() - Constructor for class view.HelpWindow
+
 
+
Herbivore - Class in model
+
+
This class simulates a herbivore.
+
+
Herbivore(int, Genome, int, int, int, int, int) - Constructor for class model.Herbivore
+
+
The constructor.
+
+
herbivore_counter - Variable in class view.GUI
+
 
+
herbivoreCounter - Variable in class controller.World
+
 
+
herbivoreGenome - Static variable in class model.Genome
+
 
+
herbivorePopulation - Static variable in class model.Simulator
+
 
+
highestGeneration - Variable in class controller.World
+
 
+
Humidity - Enum in controller
+
+
The different levels of humidity that are available.
+
+
Humidity() - Constructor for enum controller.Humidity
+
 
+
humidity - Variable in class controller.World
+
 
+
humidity - Variable in class view.InfoBox
+
 
+
humidityChooser - Variable in class view.GUI
+
 
+
hunt() - Method in class model.Carnivore
+
+
The carnivore runs toward a herbivore
+
+
+ + + +

I

+
+
id - Variable in class view.InfoBox
+
 
+
IDnumber - Variable in class model.Animal
+
 
+
incGeneration(int) - Method in class controller.World
+
+
Increment the generation counter as necessary.
+
+
incrementTurn() - Method in class controller.World
+
+
Increment the turn variable by one.
+
+
infobox - Variable in class view.Display
+
 
+
InfoBox - Class in view
+
+
This class is responsible for displaying information about a tile that was + clicked on in the simulator.
+
+
InfoBox() - Constructor for class view.InfoBox
+
+
The constructor.
+
+
information - Variable in class view.GUI
+
 
+
initMap() - Method in class model.Simulator
+
+
Initialise the map.
+
+
initPopulations() - Method in class model.Simulator
+
+
Initialise the animal populations.
+
+
initWaterTiles() - Method in class model.Simulator
+
+
Initialise the water tiles.
+
+
isAlive - Variable in class model.Animal
+
 
+
isAlive() - Method in class model.Animal
+
 
+
isNearWater - Variable in class model.MapField
+
 
+
isRunning() - Method in class controller.World
+
 
+
iterate() - Method in class main.Ecologia
+
+
Perform one iteration of the simulation.
+
+
+ + + +

L

+
+
license - Variable in class view.HelpWindow
+
 
+
loadDocFile(String) - Method in class view.HelpWindow
+
+
Load a documentation file.
+
+
localHumidity - Variable in class model.MapField
+
 
+
log(String) - Static method in class main.EcologiaIO
+
+
Print a log message if the verbose flag is set.
+
+
logging - Static variable in class main.EcologiaIO
+
 
+
logging - Variable in class view.ProgramConfig
+
 
+
+ + + +

M

+
+
main - package main
+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+
main(String[]) - Static method in class main.Ecologia
+
+
Launch the program.
+
+
main_panel - Variable in class view.HelpWindow
+
 
+
mainBox - Variable in class view.GenomeConfig
+
 
+
mainBox - Variable in class view.ProgramConfig
+
 
+
mainBox - Variable in class view.SimulationConfig
+
 
+
map - Static variable in class model.Simulator
+
 
+
MapField - Class in model
+
+
This is a representation of a discrete area (tile) on the map.
+
+
MapField(int, int, OccupantType, Humidity, int) - Constructor for class model.MapField
+
+
The constructor.
+
+
mat_age - Variable in class view.InfoBox
+
 
+
maturityAge - Variable in class model.Genome
+
 
+
maturityAge - Variable in class view.GenomeConfig
+
 
+
menubar - Variable in class view.GUI
+
 
+
metabolism - Variable in class model.Genome
+
 
+
metabolism - Variable in class view.GenomeConfig
+
 
+
mixedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
model - package model
+
+
model is responsible for the program logic.
+
+
mouseClicked(MouseEvent) - Method in class view.Display
+
 
+
mouseEntered(MouseEvent) - Method in class view.Display
+
 
+
mouseExited(MouseEvent) - Method in class view.Display
+
 
+
mousePressed(MouseEvent) - Method in class view.Display
+
 
+
mouseReleased(MouseEvent) - Method in class view.Display
+
 
+
move(Direction) - Method in class model.Animal
+
+
The animal moves in the specified direction.
+
+
movesThisTurn - Variable in class model.Animal
+
 
+
moveToNewGrazingGrounds() - Method in class model.Herbivore
+
+
Search the surrounding squares for one with a higher grass density and move there
+
+
mut_rate - Variable in class view.InfoBox
+
 
+
mutation(int) - Method in class model.Genome
+
+
Returns a mutation factor depending on the specified mutation rate.
+
+
mutationRate - Variable in class model.Genome
+
 
+
mutationRate - Variable in class view.GenomeConfig
+
 
+
+ + + +

N

+
+
nCarnLabel - Variable in class view.SimulationConfig
+
 
+
nearWater() - Method in class model.MapField
+
 
+
new_run - Variable in class view.GUI
+
 
+
news - Variable in class controller.World
+
 
+
newsTest() - Method in class main.EcoTest
+
+
Test the new setup of the news ticker.
+
+
next - Variable in class view.GUI
+
 
+
nextDirection(boolean) - Method in enum model.Direction
+
+
Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
+
+
nextID - Variable in class controller.World
+
 
+
nHerbLabel - Variable in class view.SimulationConfig
+
 
+
no_carnivores - Variable in class view.SimulationConfig
+
 
+
no_herbivores - Variable in class view.SimulationConfig
+
 
+
no_water_tiles - Variable in class view.SimulationConfig
+
 
+
noGUI - Static variable in class main.Ecologia
+
 
+
+ + + +

O

+
+
occupant - Variable in class model.MapField
+
 
+
OccupantType - Enum in controller
+
+
This is a list of all the possible elements that can occupy a field.
+
+
OccupantType() - Constructor for enum controller.OccupantType
+
 
+
occupied_by - Variable in class view.InfoBox
+
 
+
offspring - Variable in class model.Animal
+
 
+
offspring - Variable in class view.InfoBox
+
 
+
oppositeDirection() - Method in enum model.Direction
+
+
Return the opposite direction
+
+
+ + + +

P

+
+
paintComponent(Graphics) - Method in class view.Display
+
+
Draw the current status of the simulation onto the panel.
+
+
parent - Variable in class model.Animal
+
 
+
parent - Variable in class view.InfoBox
+
 
+
predatorPosition - Variable in class model.Herbivore
+
 
+
preyPosition - Variable in class model.Carnivore
+
 
+
printHelp() - Static method in class main.Ecologia
+
+
Print a short help text when invoked from the commandline
+
+
printStatus() - Static method in class main.EcologiaIO
+
+
Print out which flags are set.
+
+
programConfig - Variable in class view.GUI
+
 
+
ProgramConfig - Class in view
+
+
This class provides a GUI to configure program options (these can + also be set via commandline flags).
+
+
ProgramConfig() - Constructor for class view.ProgramConfig
+
+
The constructor
+
+
programConfigBox - Variable in class view.GUI
+
 
+
+ + + +

R

+
+
random - Variable in class model.Animal
+
 
+
random - Variable in class model.Genome
+
 
+
random - Variable in class model.Simulator
+
 
+
randomDirection() - Static method in enum model.Direction
+
+
Return a random direction
+
+
randomizedSearch(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
readConfigFile(String) - Method in class controller.World
+
+
Read and parse a config file.
+
+
reduceGrassDensity(int) - Method in class model.MapField
+
 
+
refresh() - Method in class view.InfoBox
+
+
Refresh the Infobox with the data of a new tile.
+
+
refresh() - Method in class view.ProgramConfig
+
+
Refresh values displayed in the text fields.
+
+
refresh() - Method in class view.SimulationConfig
+
+
Refresh values displayed in the text fields.
+
+
removeAnimal(int, int, OccupantType) - Static method in class model.Simulator
+
+
Remove an animal from the population
+
+
rep_energy - Variable in class view.InfoBox
+
 
+
repr_rate - Variable in class view.InfoBox
+
 
+
reproduce() - Method in class model.Animal
+
+
The animal reproduces, setting down a child on a neighbouring square
+
+
reproduceMidwinter() - Method in class main.EcoTest
+
+
Try and reproduce the Midwinter bug (random freezing)
+
+
reproductionRate - Variable in class model.Genome
+
 
+
reproductionRate - Variable in class view.GenomeConfig
+
 
+
reproductionTest() - Method in class main.EcoTest
+
+
Does reproduction work?
+
+
reproductiveEnergy - Variable in class model.Genome
+
 
+
reproductiveEnergy - Variable in class view.GenomeConfig
+
 
+
reset() - Method in class controller.World
+
+
Reset the world run-time variables, ready for a new run.
+
+
reset() - Method in class main.Ecologia
+
+
Reset the simulator in order to start a new run.
+
+
reset() - Method in class view.GUI
+
+
Destroy all windows in preparation for a new run.
+
+
run() - Method in class main.Ecologia
+
+
Run the simulation.
+
+
run - Variable in class view.GUI
+
 
+
running - Variable in class controller.World
+
 
+
runningThread - Variable in class main.Ecologia
+
 
+
runTest() - Method in class main.EcoTest
+
+
Run a test (called first thing every update by the main class when in debug mode)
+
+
+ + + +

S

+
+
scroller - Variable in class view.HelpWindow
+
 
+
scrollscreen - Variable in class view.GUI
+
 
+
scrollticker - Variable in class view.GUI
+
 
+
search(OccupantType) - Method in class model.Animal
+
+
Search for the inputed object within the line of sight.
+
+
serialVersionUID - Static variable in class view.GUI
+
 
+
setAge(int) - Method in class model.Animal
+
 
+
setAnimals(ArrayList<HashMap<String, Integer>>) - Method in class controller.World
+
 
+
setAutorun(int) - Method in class controller.World
+
 
+
setAverageGrassDensity(int) - Method in class controller.World
+
 
+
setCarnivoreCount(int) - Method in class controller.World
+
 
+
setDefaultGenome(OccupantType, int, int, int, int, int, int, int, int, int, int, int) - Method in class controller.World
+
+
Interface for the Genome method
+
+
setEnergy(int) - Method in class model.Animal
+
 
+
setHerbivoreCount(int) - Method in class controller.World
+
 
+
setHumidity(Humidity) - Method in class controller.World
+
 
+
setLocalHumidity(Humidity) - Method in class model.MapField
+
 
+
setNearWater(boolean) - Method in class model.MapField
+
 
+
setOccupant(OccupantType) - Method in class model.MapField
+
 
+
setPosition(int, int) - Method in class model.Animal
+
 
+
setRunning(boolean) - Method in class controller.World
+
 
+
setSize(int[]) - Method in class controller.World
+
 
+
setStartEnergyCarnivores(int) - Method in class controller.World
+
 
+
setStartEnergyHerbivores(int) - Method in class controller.World
+
 
+
setStartGrassDensity(int) - Method in class controller.World
+
 
+
setStartNoCarnivores(int) - Method in class controller.World
+
 
+
setStartNoHerbivores(int) - Method in class controller.World
+
 
+
setStartNoWaterTiles(int) - Method in class controller.World
+
 
+
setStopAt(int) - Method in class controller.World
+
 
+
setTimelapse(int) - Method in class controller.World
+
 
+
show(int, int) - Method in class view.InfoBox
+
+
Displays the information about the specified tile
+
+
showConfig() - Method in class view.ProgramConfig
+
+
Show the configuration window
+
+
showConfig(boolean) - Method in class view.SimulationConfig
+
+
Show the configuration window
+
+
showGenomeConfig(boolean) - Method in class view.GenomeConfig
+
+
Update the box and make it visible
+
+
showRestartDialog - Variable in class view.GenomeConfig
+
 
+
showRestartDialog - Variable in class view.SimulationConfig
+
 
+
sight - Variable in class model.Genome
+
 
+
sight - Variable in class view.GenomeConfig
+
 
+
simConfigBox - Variable in class view.GUI
+
 
+
simulationConfig - Variable in class view.GUI
+
 
+
SimulationConfig - Class in view
+
+
This class is used to graphically configure simulation parameters + prior to the start of a run.
+
+
SimulationConfig() - Constructor for class view.SimulationConfig
+
+
The constructor
+
+
simulator - Variable in class main.Ecologia
+
 
+
Simulator - Class in model
+
+
The Simulator class is the main class of the model package.
+
+
Simulator() - Constructor for class model.Simulator
+
+
The constructor.
+
+
size - Variable in class controller.World
+
 
+
size - Variable in class view.Display
+
 
+
speed - Variable in class model.Genome
+
 
+
speed - Variable in class view.GenomeConfig
+
 
+
speed - Variable in class view.InfoBox
+
 
+
speedSlider - Variable in class view.GUI
+
 
+
stamina - Variable in class model.Genome
+
 
+
stamina - Variable in class view.GenomeConfig
+
 
+
stamina - Variable in class view.InfoBox
+
 
+
startEnergyCarnivores - Variable in class controller.World
+
 
+
startEnergyHerbivores - Variable in class controller.World
+
 
+
startGrassDensity - Variable in class controller.World
+
 
+
startNoCarnivores - Variable in class controller.World
+
 
+
startNoHerbivores - Variable in class controller.World
+
 
+
startThread() - Method in class main.Ecologia
+
+
Start the simulation.
+
+
stopAt - Variable in class controller.World
+
 
+
stopAtField - Variable in class view.GUI
+
 
+
strength - Variable in class model.Genome
+
 
+
strength - Variable in class view.GenomeConfig
+
 
+
strength - Variable in class view.InfoBox
+
 
+
strengthEnergyFight(int, int, int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength and current energy of the combatants.
+
+
strengthFight(int, int) - Method in class model.Carnivore
+
+
A fight method based on the strength of the combatants.
+
+
+ + + +

T

+
+
tab_pane - Variable in class view.InfoBox
+
 
+
tester - Variable in class main.Ecologia
+
 
+
testing - Variable in class main.EcoTest
+
 
+
testPopulationChanges() - Method in class main.EcoTest
+
+
Add, move and remove an animal
+
+
text - Variable in class view.HelpWindow
+
 
+
ticker - Variable in class view.GUI
+
 
+
tile_box - Variable in class view.InfoBox
+
 
+
timelapse - Variable in class controller.World
+
 
+
toInt() - Method in enum controller.OccupantType
+
+
Convert an enum entry to an integer
+
+
toString() - Method in enum controller.OccupantType
+
+
Return the string representation of an entry.
+
+
total_fights - Static variable in class model.Carnivore
+
 
+
tpcX - Variable in class main.EcoTest
+
 
+
tpcY - Variable in class main.EcoTest
+
 
+
turn - Variable in class controller.World
+
 
+
type - Variable in class model.Animal
+
 
+
type - Variable in class view.InfoBox
+
 
+
typeChooser - Variable in class view.GenomeConfig
+
 
+
+ + + +

U

+
+
update() - Method in class model.Animal
+
+
This method has to be called by every species.
+
+
update() - Method in class model.Carnivore
+
+
Each turn, the carnivore looks for a herbivore and moves towards it.
+
+
update() - Method in class model.Herbivore
+
+
Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
+
+
update() - Method in class model.Simulator
+
+
Updates the model each turn.
+
+
update() - Method in class view.Display
+
+
Update the display
+
+
update() - Method in class view.GenomeConfig
+
+
Update all the text fields.
+
+
update() - Method in class view.GUI
+
+
Update the GUI.
+
+
update_counter - Variable in class view.GUI
+
 
+
updateWorld() - Method in class model.Simulator
+
+
Send the current state of the simulation on to World
+
+
updateWorld() - Method in class view.GenomeConfig
+
+
Update the default genome values
+
+
updateWorld() - Method in class view.ProgramConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
updateWorld() - Method in class view.SimulationConfig
+
+
Extract all the settings from the text fields and update the world parameters
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum controller.Humidity
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum controller.OccupantType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum model.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum controller.Humidity
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum controller.OccupantType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum model.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
verbose - Static variable in class main.EcologiaIO
+
 
+
verbose - Variable in class view.ProgramConfig
+
 
+
version - Static variable in class main.Ecologia
+
 
+
view - package view
+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ + + +

W

+
+
waterLabel - Variable in class view.SimulationConfig
+
 
+
waterTiles - Variable in class controller.World
+
 
+
width - Variable in class view.SimulationConfig
+
 
+
World - Class in controller
+
+
The World class acts as a communicator between the model and the view packages.
+
+
World() - Constructor for class controller.World
+
+
This class implements Singleton, therefore the constructor is private.
+
+
world - Static variable in class controller.World
+
 
+
writeFile(String) - Static method in class main.EcologiaIO
+
+
Write a message to file
+
+
+ + + +

X

+
+
x - Variable in class model.Animal
+
 
+
x - Variable in class model.MapField
+
 
+
xtile - Variable in class view.InfoBox
+
 
+
+ + + +

Y

+
+
y - Variable in class model.Animal
+
 
+
y - Variable in class model.MapField
+
 
+
ytile - Variable in class view.InfoBox
+
 
+
+A B C D E F G H I L M N O P R S T U V W X Y 
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100755 index 0000000..83a012b --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/main/EcoTest.html b/doc/javadoc/main/EcoTest.html new file mode 100755 index 0000000..32e9227 --- /dev/null +++ b/doc/javadoc/main/EcoTest.html @@ -0,0 +1,405 @@ + + + + + +EcoTest + + + + + + + + + + + + +
+
main
+

Class EcoTest

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcoTest
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class EcoTest
    +extends java.lang.Object
    +
    This class is used to test new features in Ecologia during development. + Only executes when in debugging is turned on and the testing variable + (below) is set to true. + + TODO: expand this into a proper testing framework?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private booleantesting 
      (package private) inttpcX 
      (package private) inttpcY 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcoTest() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidnewsTest() +
      Test the new setup of the news ticker.
      +
      voidreproduceMidwinter() +
      Try and reproduce the Midwinter bug (random freezing)
      +
      voidreproductionTest() +
      Does reproduction work?
      +
      voidrunTest() +
      Run a test (called first thing every update by the main class when in debug mode)
      +
      voidtestPopulationChanges() +
      Add, move and remove an animal
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        testing

        +
        private boolean testing
        +
      • +
      + + + +
        +
      • +

        tpcX

        +
        int tpcX
        +
      • +
      + + + +
        +
      • +

        tpcY

        +
        int tpcY
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcoTest

        +
        public EcoTest()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        runTest

        +
        public void runTest()
        +
        Run a test (called first thing every update by the main class when in debug mode)
        +
      • +
      + + + +
        +
      • +

        reproduceMidwinter

        +
        public void reproduceMidwinter()
        +
        Try and reproduce the Midwinter bug (random freezing)
        +
      • +
      + + + +
        +
      • +

        reproductionTest

        +
        public void reproductionTest()
        +
        Does reproduction work?
        +
      • +
      + + + +
        +
      • +

        newsTest

        +
        public void newsTest()
        +
        Test the new setup of the news ticker.
        +
      • +
      + + + +
        +
      • +

        testPopulationChanges

        +
        public void testPopulationChanges()
        +
        Add, move and remove an animal
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/Ecologia.html b/doc/javadoc/main/Ecologia.html new file mode 100755 index 0000000..c48ea90 --- /dev/null +++ b/doc/javadoc/main/Ecologia.html @@ -0,0 +1,543 @@ + + + + + +Ecologia + + + + + + + + + + + + +
+
main
+

Class Ecologia

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.Ecologia
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class Ecologia
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers. + + Copyright (C) 2014-2016 Daniel Vedder + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + + This is the main class, which launches the application and acts as a + manager, updating the program each round.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + +
      Constructors 
      ModifierConstructor and Description
      private Ecologia() +
      Ecologia implements Singleton, so the constructor is private.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidautorun() +
      Perform an automatic run.
      +
      static EcologiagetInstance() +
      The Singleton method.
      +
      voiditerate() +
      Perform one iteration of the simulation.
      +
      static voidmain(java.lang.String[] args) +
      Launch the program.
      +
      private static voidprintHelp() +
      Print a short help text when invoked from the commandline
      +
      voidreset() +
      Reset the simulator in order to start a new run.
      +
      voidrun() +
      Run the simulation.
      +
      voidstartThread() +
      Start the simulation.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        eco

        +
        public static Ecologia eco
        +
      • +
      + + + + + + + +
        +
      • +

        noGUI

        +
        private static boolean noGUI
        +
      • +
      + + + +
        +
      • +

        gui

        +
        private GUI gui
        +
      • +
      + + + +
        +
      • +

        simulator

        +
        private Simulator simulator
        +
      • +
      + + + +
        +
      • +

        tester

        +
        private EcoTest tester
        +
      • +
      + + + +
        +
      • +

        runningThread

        +
        private java.lang.Thread runningThread
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Ecologia

        +
        private Ecologia()
        +
        Ecologia implements Singleton, so the constructor is private.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String[] args)
        +
        Launch the program. + see printHelp() for possible arguments
        +
      • +
      + + + +
        +
      • +

        getInstance

        +
        public static Ecologia getInstance()
        +
        The Singleton method.
        +
      • +
      + + + +
        +
      • +

        autorun

        +
        private void autorun()
        +
        Perform an automatic run.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Reset the simulator in order to start a new run. + + XXX: Depending on how long the simulation has already + been running, this can take quite a long time.
        +
      • +
      + + + +
        +
      • +

        startThread

        +
        public void startThread()
        +
        Start the simulation.
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Run the simulation.
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      + + + +
        +
      • +

        iterate

        +
        public void iterate()
        +
        Perform one iteration of the simulation.
        +
      • +
      + + + +
        +
      • +

        printHelp

        +
        private static void printHelp()
        +
        Print a short help text when invoked from the commandline
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/EcologiaIO.html b/doc/javadoc/main/EcologiaIO.html new file mode 100755 index 0000000..46c772c --- /dev/null +++ b/doc/javadoc/main/EcologiaIO.html @@ -0,0 +1,588 @@ + + + + + +EcologiaIO + + + + + + + + + + + + +
+
main
+

Class EcologiaIO

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • main.EcologiaIO
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class EcologiaIO
    +extends java.lang.Object
    +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EcologiaIO() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidanalysis(java.lang.String message) +
      Print an analysis message if the analysing flag is set.
      +
      static voidarchiveLog() +
      Archive the current log file, ready for a new run
      +
      static voiddebug(java.lang.String message) +
      Print a debug message if the debug flag is set.
      +
      static voiderror(java.lang.String message) +
      Print an error message
      +
      static voiderror(java.lang.String message, + java.lang.Exception error) +
      Print an error message and the stack trace
      +
      static voiderror(java.lang.String message, + int errorType) +
      Give an error message and pause/shut down
      +
      private static java.lang.StringgetDate() 
      static voidlog(java.lang.String message) +
      Print a log message if the verbose flag is set.
      +
      static voidprintStatus() +
      Print out which flags are set.
      +
      private static voidwriteFile(java.lang.String message) +
      Write a message to file
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        verbose

        +
        public static boolean verbose
        +
      • +
      + + + +
        +
      • +

        debugging

        +
        public static boolean debugging
        +
      • +
      + + + +
        +
      • +

        analysing

        +
        public static boolean analysing
        +
      • +
      + + + +
        +
      • +

        logging

        +
        public static boolean logging
        +
      • +
      + + + +
        +
      • +

        CONTINUABLE_ERROR

        +
        public static final int CONTINUABLE_ERROR
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + + + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EcologiaIO

        +
        public EcologiaIO()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public static void log(java.lang.String message)
        +
        Print a log message if the verbose flag is set. + This is meant to be used for important runtime events in the program, + and for fundamental (e.g. birth and death) events during the simulation. + For more detailed output, use either debug() or analysis().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public static void debug(java.lang.String message)
        +
        Print a debug message if the debug flag is set. + This is primarily intended for use during development. + Experimental data should go to analysis(), important + messages to log().
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        analysis

        +
        public static void analysis(java.lang.String message)
        +
        Print an analysis message if the analysing flag is set. + This is meant to be used for simulation data output relevant only to a + current experiment. + + FIXME A lot of analysis() calls slow the program down drastically. + Implement caching?
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message)
        +
        Print an error message
        +
        +
        Parameters:
        +
        message -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         java.lang.Exception error)
        +
        Print an error message and the stack trace
        +
        +
        Parameters:
        +
        message -
        +
        error -
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public static void error(java.lang.String message,
        +                         int errorType)
        +
        Give an error message and pause/shut down
        +
        +
        Parameters:
        +
        message -
        +
        errorType - CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR
        +
        +
      • +
      + + + +
        +
      • +

        archiveLog

        +
        public static void archiveLog()
        +
        Archive the current log file, ready for a new run
        +
      • +
      + + + +
        +
      • +

        printStatus

        +
        public static void printStatus()
        +
        Print out which flags are set.
        +
      • +
      + + + +
        +
      • +

        writeFile

        +
        private static void writeFile(java.lang.String message)
        +
        Write a message to file
        +
      • +
      + + + +
        +
      • +

        getDate

        +
        private static java.lang.String getDate()
        +
        +
        Returns:
        +
        time stamp
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/main/package-frame.html b/doc/javadoc/main/package-frame.html new file mode 100755 index 0000000..5f56d7b --- /dev/null +++ b/doc/javadoc/main/package-frame.html @@ -0,0 +1,22 @@ + + + + + +main + + + + + +

main

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/main/package-summary.html b/doc/javadoc/main/package-summary.html new file mode 100755 index 0000000..878ae5c --- /dev/null +++ b/doc/javadoc/main/package-summary.html @@ -0,0 +1,169 @@ + + + + + +main + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package main

+
+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Ecologia +
    Ecologia is a relatively simple ecosystem simulator, designed to show basic + relationships between predators, prey and producers.
    +
    EcologiaIO +
    This class provides unified I/O methods for debugging, + logging, error messages, etc.
    +
    EcoTest +
    This class is used to test new features in Ecologia during development.
    +
    +
  • +
+ + + +

Package main Description

+
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/main/package-tree.html b/doc/javadoc/main/package-tree.html new file mode 100755 index 0000000..5df1a89 --- /dev/null +++ b/doc/javadoc/main/package-tree.html @@ -0,0 +1,139 @@ + + + + + +main Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package main

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/Animal.html b/doc/javadoc/model/Animal.html new file mode 100755 index 0000000..749872d --- /dev/null +++ b/doc/javadoc/model/Animal.html @@ -0,0 +1,938 @@ + + + + + +Animal + + + + + + + + + + + + +
+
model
+

Class Animal

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Animal
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    Carnivore, Herbivore
    +
    +
    +
    +
    public abstract class Animal
    +extends java.lang.Object
    +
    This is the superclass of all animal classes. It holds common methods + needed by all animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Animal(int setID, + OccupantType myType, + Genome newGenome, + int myGeneration, + int setX, + int setY, + int setEnergy, + int parentID) +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidchangeEnergy(int amount) +
      Change the energy level of this animal.
      +
      int[]closestSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidexhaust(int e) 
      intgetAge() 
      DirectiongetDirection(int xpos, + int ypos) +
      In which direction are the given coordinates relative to this animal?
      +
      intgetDistance(int xpos, + int ypos) +
      How many steps are needed to get to the specified position?
      +
      intgetEnergy() 
      intgetGeneration() 
      GenomegetGenome() 
      longgetID() 
      java.util.HashMap<java.lang.String,java.lang.Integer>getInfo() +
      Return a hash map containing all the information about this animal.
      +
      int[]getNeighbouringField(Direction dir) +
      Calculate the neighbouring square in the specified direction + (return null if out of bounds)
      +
      intgetOffspring() 
      intgetParent() 
      OccupantTypegetType() 
      intgetX() 
      intgetY() 
      booleanisAlive() 
      int[]mixedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      booleanmove(Direction dir) +
      The animal moves in the specified direction.
      +
      int[]randomizedSearch(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidreproduce() +
      The animal reproduces, setting down a child on a neighbouring square
      +
      int[]search(OccupantType type) +
      Search for the inputed object within the line of sight.
      +
      voidsetAge(int newAge) 
      voidsetEnergy(int newEnergy) 
      voidsetPosition(int newX, + int newY) 
      voidupdate() +
      This method has to be called by every species.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        IDnumber

        +
        protected int IDnumber
        +
      • +
      + + + +
        +
      • +

        parent

        +
        protected int parent
        +
      • +
      + + + +
        +
      • +

        genome

        +
        protected Genome genome
        +
      • +
      + + + +
        +
      • +

        generation

        +
        protected int generation
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        protected int offspring
        +
      • +
      + + + + + + + +
        +
      • +

        x

        +
        protected int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        protected int y
        +
      • +
      + + + +
        +
      • +

        age

        +
        protected int age
        +
      • +
      + + + +
        +
      • +

        energy

        +
        protected int energy
        +
      • +
      + + + +
        +
      • +

        movesThisTurn

        +
        protected int movesThisTurn
        +
      • +
      + + + +
        +
      • +

        attemptedMovesThisTurn

        +
        protected int attemptedMovesThisTurn
        +
      • +
      + + + +
        +
      • +

        exhaustion

        +
        protected int exhaustion
        +
      • +
      + + + +
        +
      • +

        gestationPeriod

        +
        protected int gestationPeriod
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        protected boolean isAlive
        +
      • +
      + + + +
        +
      • +

        random

        +
        protected java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Animal

        +
        public Animal(int setID,
        +              OccupantType myType,
        +              Genome newGenome,
        +              int myGeneration,
        +              int setX,
        +              int setY,
        +              int setEnergy,
        +              int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        myType -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        This method has to be called by every species.
        +
      • +
      + + + +
        +
      • +

        reproduce

        +
        public void reproduce()
        +
        The animal reproduces, setting down a child on a neighbouring square
        +
      • +
      + + + +
        +
      • +

        move

        +
        public boolean move(Direction dir)
        +
        The animal moves in the specified direction.
        +
        +
        Returns:
        +
        success
        +
        +
      • +
      + + + +
        +
      • +

        search

        +
        public int[] search(OccupantType type)
        +
        Search for the inputed object within the line of sight.
        +
      • +
      + + + +
        +
      • +

        randomizedSearch

        +
        public int[] randomizedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + The returned coordinates are chosen at random from a list of eligible ones.
        +
      • +
      + + + +
        +
      • +

        closestSearch

        +
        public int[] closestSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + Finds the object closest to the individual.
        +
      • +
      + + + +
        +
      • +

        mixedSearch

        +
        public int[] mixedSearch(OccupantType type)
        +
        Search for the inputed object within the line of sight. + A random target is chosen out of a list of targets closest to the individual.
        +
      • +
      + + + +
        +
      • +

        getNeighbouringField

        +
        public int[] getNeighbouringField(Direction dir)
        +
        Calculate the neighbouring square in the specified direction + (return null if out of bounds)
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Direction getDirection(int xpos,
        +                              int ypos)
        +
        In which direction are the given coordinates relative to this animal?
        +
        +
        Parameters:
        +
        xpos -
        +
        ypos -
        +
        Returns:
        +
        Direction
        +
        +
      • +
      + + + +
        +
      • +

        getDistance

        +
        public int getDistance(int xpos,
        +                       int ypos)
        +
        How many steps are needed to get to the specified position?
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this animal.
        +
      • +
      + + + +
        +
      • +

        isAlive

        +
        public boolean isAlive()
        +
      • +
      + + + +
        +
      • +

        getID

        +
        public long getID()
        +
      • +
      + + + +
        +
      • +

        getGenome

        +
        public Genome getGenome()
        +
      • +
      + + + +
        +
      • +

        getGeneration

        +
        public int getGeneration()
        +
      • +
      + + + +
        +
      • +

        getParent

        +
        public int getParent()
        +
      • +
      + + + +
        +
      • +

        getOffspring

        +
        public int getOffspring()
        +
      • +
      + + + + + + + +
        +
      • +

        getX

        +
        public int getX()
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public int getY()
        +
      • +
      + + + +
        +
      • +

        getAge

        +
        public int getAge()
        +
      • +
      + + + +
        +
      • +

        getEnergy

        +
        public int getEnergy()
        +
      • +
      + + + +
        +
      • +

        changeEnergy

        +
        public void changeEnergy(int amount)
        +
        Change the energy level of this animal. If it dips to <= 0, the animal + dies and is removed. This is a convenience wrapper method around + setEnergy().
        +
        +
        Parameters:
        +
        amount -
        +
        +
      • +
      + + + +
        +
      • +

        setEnergy

        +
        public void setEnergy(int newEnergy)
        +
      • +
      + + + +
        +
      • +

        setAge

        +
        public void setAge(int newAge)
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int newX,
        +                        int newY)
        +
      • +
      + + + +
        +
      • +

        exhaust

        +
        public void exhaust(int e)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Carnivore.html b/doc/javadoc/model/Carnivore.html new file mode 100755 index 0000000..822d613 --- /dev/null +++ b/doc/javadoc/model/Carnivore.html @@ -0,0 +1,488 @@ + + + + + +Carnivore + + + + + + + + + + + + +
+
model
+

Class Carnivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Carnivore
    +extends Animal
    +
    This class simulates a carnivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        fights_won

        +
        public static int fights_won
        +
      • +
      + + + +
        +
      • +

        total_fights

        +
        public static int total_fights
        +
      • +
      + + + +
        +
      • +

        preyPosition

        +
        private int[] preyPosition
        +
      • +
      + + + +
        +
      • +

        currentDirection

        +
        private Direction currentDirection
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Carnivore

        +
        public Carnivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the carnivore looks for a herbivore and moves towards it. + If no herbivore can be found, it moves in a random direction.
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        hunt

        +
        private void hunt()
        +
        The carnivore runs toward a herbivore
        +
      • +
      + + + +
        +
      • +

        attack

        +
        private void attack()
        +
        The carnivore has run down a herbivore and now tries to kill it + XXX Warning: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        strengthEnergyFight

        +
        private boolean strengthEnergyFight(int pred_str,
        +                                    int pred_en,
        +                                    int prey_str,
        +                                    int prey_en)
        +
        A fight method based on the strength and current energy of the combatants. + This method is currently not used.
        +
      • +
      + + + +
        +
      • +

        strengthFight

        +
        private boolean strengthFight(int predStrength,
        +                              int preyStrength)
        +
        A fight method based on the strength of the combatants. + This is the method currently employed.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Direction.html b/doc/javadoc/model/Direction.html new file mode 100755 index 0000000..c5654f6 --- /dev/null +++ b/doc/javadoc/model/Direction.html @@ -0,0 +1,513 @@ + + + + + +Direction + + + + + + + + + + + + +
+
model
+

Enum Direction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Direction>
    • +
    • +
        +
      • model.Direction
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Direction>
    +
    +
    +
    +
    public enum Direction
    +extends java.lang.Enum<Direction>
    +
    A list of directions and common methods related to them + is often needed by animals.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DirectionfromInt(int d) +
      Return the direction that this number refers to.
      +
      java.lang.StringgetString() +
      Return a string representation of this direction.
      +
      DirectionnextDirection(boolean clockwise) +
      Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
      +
      DirectionoppositeDirection() +
      Return the opposite direction
      +
      static DirectionrandomDirection() +
      Return a random direction
      +
      static DirectionvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Direction[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Direction[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Direction c : Direction.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Direction valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        oppositeDirection

        +
        public Direction oppositeDirection()
        +
        Return the opposite direction
        +
      • +
      + + + +
        +
      • +

        nextDirection

        +
        public Direction nextDirection(boolean clockwise)
        +
        Return the next direction, going clockwise (if cw = true) + or anticlockwise (if cw = false)
        +
        +
        Parameters:
        +
        clockwise -
        +
        +
      • +
      + + + +
        +
      • +

        randomDirection

        +
        public static Direction randomDirection()
        +
        Return a random direction
        +
      • +
      + + + +
        +
      • +

        fromInt

        +
        public static Direction fromInt(int d)
        +
        Return the direction that this number refers to.
        +
      • +
      + + + +
        +
      • +

        getString

        +
        public java.lang.String getString()
        +
        Return a string representation of this direction.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Genome.html b/doc/javadoc/model/Genome.html new file mode 100755 index 0000000..c0b5ae6 --- /dev/null +++ b/doc/javadoc/model/Genome.html @@ -0,0 +1,753 @@ + + + + + +Genome + + + + + + + + + + + + +
+
model
+

Class Genome

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Genome
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Genome
    +extends java.lang.Object
    +
    A genome holds a number of variables ("genes") that determine an animals characteristics. + Note: this class has three constructors!
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Genome() +
      The default constructor provides a standard genome.
      +
      Genome(Genome parentGenome) +
      This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
      +
      Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars) +
      This constructor creates a genome from a HashMap.
      +
      Genome(int mutationRate, + int speed, + int stamina, + int sight, + int metabolism, + int ageLimit, + int strength, + int reproductiveEnergy, + int maturityAge, + int gestation, + int reproductionRate) +
      This constructor creates a genome from the values passed to it.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mutationRate

        +
        private int mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private int speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private int stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private int sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private int metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private int ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private int strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private int reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private int maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private int gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private int reproductionRate
        +
      • +
      + + + +
        +
      • +

        DEFAULT_MUTATION_RATE

        +
        private final int DEFAULT_MUTATION_RATE
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        herbivoreGenome

        +
        private static Genome herbivoreGenome
        +
      • +
      + + + +
        +
      • +

        carnivoreGenome

        +
        private static Genome carnivoreGenome
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Genome

        +
        public Genome()
        +
        The default constructor provides a standard genome.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(Genome parentGenome)
        +
        This constructor creates a new genome based on the parent genome passed + to it, mutating it at random.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(int mutationRate,
        +              int speed,
        +              int stamina,
        +              int sight,
        +              int metabolism,
        +              int ageLimit,
        +              int strength,
        +              int reproductiveEnergy,
        +              int maturityAge,
        +              int gestation,
        +              int reproductionRate)
        +
        This constructor creates a genome from the values passed to it.
        +
      • +
      + + + +
        +
      • +

        Genome

        +
        public Genome(java.util.HashMap<java.lang.String,java.lang.Integer> genVars)
        +
        This constructor creates a genome from a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        mutation

        +
        private int mutation(int coefficient)
        +
        Returns a mutation factor depending on the specified mutation rate.
        +
        +
        Parameters:
        +
        coefficient - Influences the size of the returned factor.
        +
        Returns:
        +
        factor The wanted mutation factor.
        +
        +
      • +
      + + + +
        +
      • +

        checkGenome

        +
        private void checkGenome()
        +
        Check to make sure that no "gene" has a value below zero
        +
      • +
      + + + +
        +
      • +

        asHashMap

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> asHashMap()
        +
        Return all the "genes" of this genome in a single HashMap.
        +
        +
        Returns:
        +
        genomeInfo
        +
        +
      • +
      + + + +
        +
      • +

        getMutationRate

        +
        public int getMutationRate()
        +
      • +
      + + + +
        +
      • +

        getSpeed

        +
        public int getSpeed()
        +
      • +
      + + + +
        +
      • +

        getStamina

        +
        public int getStamina()
        +
      • +
      + + + +
        +
      • +

        getSight

        +
        public int getSight()
        +
      • +
      + + + +
        +
      • +

        getMetabolism

        +
        public int getMetabolism()
        +
      • +
      + + + +
        +
      • +

        getAgeLimit

        +
        public int getAgeLimit()
        +
      • +
      + + + +
        +
      • +

        getStrength

        +
        public int getStrength()
        +
      • +
      + + + +
        +
      • +

        getReproductiveEnergy

        +
        public int getReproductiveEnergy()
        +
      • +
      + + + +
        +
      • +

        getMaturityAge

        +
        public int getMaturityAge()
        +
      • +
      + + + +
        +
      • +

        getGestation

        +
        public int getGestation()
        +
      • +
      + + + +
        +
      • +

        getReproductionRate

        +
        public int getReproductionRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Herbivore.html b/doc/javadoc/model/Herbivore.html new file mode 100755 index 0000000..9be99b1 --- /dev/null +++ b/doc/javadoc/model/Herbivore.html @@ -0,0 +1,423 @@ + + + + + +Herbivore + + + + + + + + + + + + +
+
model
+

Class Herbivore

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+
    +
  • +
    +
    +
    public class Herbivore
    +extends Animal
    +
    This class simulates a herbivore.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        predatorPosition

        +
        private int[] predatorPosition
        +
      • +
      + + + +
        +
      • +

        defaultGenome

        +
        public static Genome defaultGenome
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Herbivore

        +
        public Herbivore(int setID,
        +                 Genome newGenome,
        +                 int myGeneration,
        +                 int setX,
        +                 int setY,
        +                 int setEnergy,
        +                 int parentID)
        +
        The constructor.
        +
        +
        Parameters:
        +
        setID -
        +
        newGenome -
        +
        myGeneration -
        +
        setX -
        +
        setY -
        +
        setEnergy -
        +
        parentID -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Each turn, the herbivore looks out for predators and flees if it finds any, + or otherwise grazes, if need be moving to better feeding grounds
        +
        +
        Overrides:
        +
        update in class Animal
        +
        +
      • +
      + + + +
        +
      • +

        feed

        +
        private void feed()
        +
        Graze the current tile. + XXX: here be magic numbers!
        +
      • +
      + + + +
        +
      • +

        moveToNewGrazingGrounds

        +
        private void moveToNewGrazingGrounds()
        +
        Search the surrounding squares for one with a higher grass density and move there
        +
      • +
      + + + +
        +
      • +

        flee

        +
        private void flee()
        +
        Run away from a predator
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/MapField.html b/doc/javadoc/model/MapField.html new file mode 100755 index 0000000..32871c7 --- /dev/null +++ b/doc/javadoc/model/MapField.html @@ -0,0 +1,509 @@ + + + + + +MapField + + + + + + + + + + + + +
+
model
+

Class MapField

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.MapField
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MapField
    +extends java.lang.Object
    +
    This is a representation of a discrete area (tile) on the map. It monitors + what animals are on it, what it's grass density is, etc.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        x

        +
        private int x
        +
      • +
      + + + +
        +
      • +

        y

        +
        private int y
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private int grassDensity
        +
      • +
      + + + +
        +
      • +

        isNearWater

        +
        private boolean isNearWater
        +
      • +
      + + + +
        +
      • +

        localHumidity

        +
        private Humidity localHumidity
        +
      • +
      + + + + +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MapField

        +
        public MapField(int xstart,
        +                int ystart,
        +                OccupantType newOccupant,
        +                Humidity startingHumidity,
        +                int startingGrassDensity)
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateGrassDensity

        +
        public void calculateGrassDensity()
        +
        Recalculate the grass density based on humidity values. + Min: 0 Max: 100
        +
      • +
      + + + +
        +
      • +

        getInfo

        +
        public java.util.HashMap<java.lang.String,java.lang.Integer> getInfo()
        +
        Return a hash map containing all the information about this field.
        +
      • +
      + + + +
        +
      • +

        setNearWater

        +
        public void setNearWater(boolean newValue)
        +
      • +
      + + + +
        +
      • +

        nearWater

        +
        public boolean nearWater()
        +
      • +
      + + + +
        +
      • +

        getGrassDensity

        +
        public int getGrassDensity()
        +
      • +
      + + + + + + + +
        +
      • +

        setOccupant

        +
        public void setOccupant(OccupantType occupant)
        +
      • +
      + + + +
        +
      • +

        getLocalHumidity

        +
        public Humidity getLocalHumidity()
        +
      • +
      + + + +
        +
      • +

        setLocalHumidity

        +
        public void setLocalHumidity(Humidity localHumidity)
        +
      • +
      + + + +
        +
      • +

        reduceGrassDensity

        +
        public void reduceGrassDensity(int amount)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/Simulator.html b/doc/javadoc/model/Simulator.html new file mode 100755 index 0000000..ffe713a --- /dev/null +++ b/doc/javadoc/model/Simulator.html @@ -0,0 +1,542 @@ + + + + + +Simulator + + + + + + + + + + + + +
+
model
+

Class Simulator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • model.Simulator
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Simulator
    +extends java.lang.Object
    +
    The Simulator class is the main class of the model package. It manages all + elements of the actual simulation, and passes any relevant information on + to World.
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Simulator() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidaddAnimal(Animal a) +
      Add an animal to the population
      +
      static AnimalgetAnimal(int x, + int y) +
      Return the animal at (x, y), or null if there is no animal at that field.
      +
      static CarnivoregetCarnivore(int x, + int y) +
      Return the carnivore at (x, y), or null if there is no animal at that field.
      +
      static MapFieldgetField(int x, + int y) +
      Returns the field at the required position.
      +
      static HerbivoregetHerbivore(int x, + int y) +
      Return the herbivore at (x, y), or null if there is no animal at that field.
      +
      private voidinitMap() +
      Initialise the map.
      +
      private voidinitPopulations() +
      Initialise the animal populations.
      +
      private voidinitWaterTiles() +
      Initialise the water tiles.
      +
      static voidremoveAnimal(int x, + int y, + OccupantType type) +
      Remove an animal from the population
      +
      voidupdate() +
      Updates the model each turn.
      +
      voidupdateWorld() +
      Send the current state of the simulation on to World
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        herbivorePopulation

        +
        private static java.util.ArrayList<Herbivore> herbivorePopulation
        +
      • +
      + + + +
        +
      • +

        carnivorePopulation

        +
        private static java.util.ArrayList<Carnivore> carnivorePopulation
        +
      • +
      + + + +
        +
      • +

        map

        +
        private static MapField[][] map
        +
      • +
      + + + +
        +
      • +

        random

        +
        private java.util.Random random
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Simulator

        +
        public Simulator()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Updates the model each turn.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Send the current state of the simulation on to World
        +
      • +
      + + + +
        +
      • +

        initMap

        +
        private void initMap()
        +
        Initialise the map.
        +
      • +
      + + + +
        +
      • +

        initWaterTiles

        +
        private void initWaterTiles()
        +
        Initialise the water tiles.
        +
      • +
      + + + +
        +
      • +

        initPopulations

        +
        private void initPopulations()
        +
        Initialise the animal populations.
        +
      • +
      + + + +
        +
      • +

        getField

        +
        public static MapField getField(int x,
        +                                int y)
        +
        Returns the field at the required position.
        +
        +
        Parameters:
        +
        x, - y
        +
        Returns:
        +
        MapField
        +
        +
      • +
      + + + +
        +
      • +

        getAnimal

        +
        public static Animal getAnimal(int x,
        +                               int y)
        +
        Return the animal at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getHerbivore

        +
        public static Herbivore getHerbivore(int x,
        +                                     int y)
        +
        Return the herbivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        getCarnivore

        +
        public static Carnivore getCarnivore(int x,
        +                                     int y)
        +
        Return the carnivore at (x, y), or null if there is no animal at that field.
        +
      • +
      + + + +
        +
      • +

        addAnimal

        +
        public static void addAnimal(Animal a)
        +
        Add an animal to the population
        +
        +
        Parameters:
        +
        animal -
        +
        +
      • +
      + + + +
        +
      • +

        removeAnimal

        +
        public static void removeAnimal(int x,
        +                                int y,
        +                                OccupantType type)
        +
        Remove an animal from the population
        +
        +
        Parameters:
        +
        x, - y coordinates
        +
        type - Make sure we are removing the right animal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/model/package-frame.html b/doc/javadoc/model/package-frame.html new file mode 100755 index 0000000..d4b9855 --- /dev/null +++ b/doc/javadoc/model/package-frame.html @@ -0,0 +1,29 @@ + + + + + +model + + + + + +

model

+
+

Classes

+ +

Enums

+ +
+ + diff --git a/doc/javadoc/model/package-summary.html b/doc/javadoc/model/package-summary.html new file mode 100755 index 0000000..950d3eb --- /dev/null +++ b/doc/javadoc/model/package-summary.html @@ -0,0 +1,201 @@ + + + + + +model + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package model

+
+
model is responsible for the program logic.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Animal +
    This is the superclass of all animal classes.
    +
    Carnivore +
    This class simulates a carnivore.
    +
    Genome +
    A genome holds a number of variables ("genes") that determine an animals characteristics.
    +
    Herbivore +
    This class simulates a herbivore.
    +
    MapField +
    This is a representation of a discrete area (tile) on the map.
    +
    Simulator +
    The Simulator class is the main class of the model package.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Direction +
    A list of directions and common methods related to them + is often needed by animals.
    +
    +
  • +
+ + + +

Package model Description

+
model is responsible for the program logic. This is where the actual simulation takes place.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/model/package-tree.html b/doc/javadoc/model/package-tree.html new file mode 100755 index 0000000..e6a8ea7 --- /dev/null +++ b/doc/javadoc/model/package-tree.html @@ -0,0 +1,157 @@ + + + + + +model Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100755 index 0000000..25167a5 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + +Overview List + + + + + +

Ecologia

+ +
+

Packages

+ +
+

 

+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100755 index 0000000..208adde --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,160 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Ecologia

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
controller +
controller handles all communication between model and view.
+
main +
The main package includes the class that contains the main() method, as well as any other classes that + are needed by all parts of the program, yet are not directly related to the simulation.
+
model +
model is responsible for the program logic.
+
view +
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100755 index 0000000..f30d53f --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,201 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • model.Animal + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    • main.Ecologia (implements java.lang.Runnable)
    • +
    • main.EcologiaIO
    • +
    • main.EcoTest
    • +
    • model.Genome
    • +
    • model.MapField
    • +
    • model.Simulator
    • +
    • controller.World
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100755 index 0000000..ea26e9b --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,4 @@ +controller +main +model +view diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100755 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100755 index 0000000..5c50d3e --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,664 @@ + + + + + +Serialized Form + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Serialized Form

+
+
+
    +
  • +

    Package view

    +
      +
    • + + +

      Class view.Display extends javax.swing.JPanel implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          size

          +
          int[] size
          +
        • +
        • +

          infobox

          +
          InfoBox infobox
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GenomeConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          typeChooser

          +
          javax.swing.JComboBox<E> typeChooser
          +
        • +
        • +

          mutationRate

          +
          javax.swing.JTextField mutationRate
          +
        • +
        • +

          speed

          +
          javax.swing.JTextField speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JTextField stamina
          +
        • +
        • +

          sight

          +
          javax.swing.JTextField sight
          +
        • +
        • +

          metabolism

          +
          javax.swing.JTextField metabolism
          +
        • +
        • +

          ageLimit

          +
          javax.swing.JTextField ageLimit
          +
        • +
        • +

          strength

          +
          javax.swing.JTextField strength
          +
        • +
        • +

          reproductiveEnergy

          +
          javax.swing.JTextField reproductiveEnergy
          +
        • +
        • +

          maturityAge

          +
          javax.swing.JTextField maturityAge
          +
        • +
        • +

          gestation

          +
          javax.swing.JTextField gestation
          +
        • +
        • +

          reproductionRate

          +
          javax.swing.JTextField reproductionRate
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.GUI extends javax.swing.JFrame implements Serializable

      +
      +
      serialVersionUID:
      +
      4727895060816956404L
      +
      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          information

          +
          javax.swing.Box information
          +
        • +
        • +

          menubar

          +
          javax.swing.JMenuBar menubar
          +
        • +
        • +

          file

          +
          javax.swing.JMenu file
          +
        • +
        • +

          configuration

          +
          javax.swing.JMenu configuration
          +
        • +
        • +

          help_menu

          +
          javax.swing.JMenu help_menu
          +
        • +
        • +

          new_run

          +
          javax.swing.JMenuItem new_run
          +
        • +
        • +

          exit

          +
          javax.swing.JMenuItem exit
          +
        • +
        • +

          programConfigBox

          +
          javax.swing.JMenuItem programConfigBox
          +
        • +
        • +

          simConfigBox

          +
          javax.swing.JMenuItem simConfigBox
          +
        • +
        • +

          genomeConfigBox

          +
          javax.swing.JMenuItem genomeConfigBox
          +
        • +
        • +

          configFileDialog

          +
          javax.swing.JMenuItem configFileDialog
          +
        • +
        • +

          help

          +
          javax.swing.JMenuItem help
          +
        • +
        • +

          about

          +
          javax.swing.JMenuItem about
          +
        • +
        • +

          update_counter

          +
          javax.swing.JLabel update_counter
          +
        • +
        • +

          herbivore_counter

          +
          javax.swing.JLabel herbivore_counter
          +
        • +
        • +

          carnivore_counter

          +
          javax.swing.JLabel carnivore_counter
          +
        • +
        • +

          generation_counter

          +
          javax.swing.JLabel generation_counter
          +
        • +
        • +

          grass_counter

          +
          javax.swing.JLabel grass_counter
          +
        • +
        • +

          humidityChooser

          +
          javax.swing.JComboBox<E> humidityChooser
          +
        • +
        • +

          ticker

          +
          javax.swing.JTextArea ticker
          +
        • +
        • +

          stopAtField

          +
          javax.swing.JTextField stopAtField
          +
        • +
        • +

          disableDisplay

          +
          javax.swing.JCheckBox disableDisplay
          +
        • +
        • +

          scrollticker

          +
          javax.swing.JScrollPane scrollticker
          +
        • +
        • +

          scrollscreen

          +
          javax.swing.JScrollPane scrollscreen
          +
        • +
        • +

          run

          +
          javax.swing.JButton run
          +
        • +
        • +

          next

          +
          javax.swing.JButton next
          +
        • +
        • +

          speedSlider

          +
          javax.swing.JSlider speedSlider
          +
        • +
        • +

          display

          +
          Display display
          +
        • +
        • +

          programConfig

          +
          ProgramConfig programConfig
          +
        • +
        • +

          simulationConfig

          +
          SimulationConfig simulationConfig
          +
        • +
        • +

          genomeConfig

          +
          GenomeConfig genomeConfig
          +
        • +
        • +

          configChooser

          +
          javax.swing.JFileChooser configChooser
          +
        • +
        • +

          helpWindow

          +
          HelpWindow helpWindow
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.HelpWindow extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          text

          +
          javax.swing.JTextArea text
          +
        • +
        • +

          scroller

          +
          javax.swing.JScrollPane scroller
          +
        • +
        • +

          main_panel

          +
          javax.swing.Box main_panel
          +
        • +
        • +

          button_panel

          +
          javax.swing.Box button_panel
          +
        • +
        • +

          help

          +
          javax.swing.JButton help
          +
        • +
        • +

          concepts

          +
          javax.swing.JButton concepts
          +
        • +
        • +

          license

          +
          javax.swing.JButton license
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.InfoBox extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          xtile

          +
          int xtile
          +
        • +
        • +

          ytile

          +
          int ytile
          +
        • +
        • +

          animalInfo

          +
          java.util.HashMap<K,V> animalInfo
          +
        • +
        • +

          tab_pane

          +
          javax.swing.JTabbedPane tab_pane
          +
        • +
        • +

          tile_box

          +
          javax.swing.Box tile_box
          +
        • +
        • +

          animal_box

          +
          javax.swing.Box animal_box
          +
        • +
        • +

          coordinates

          +
          javax.swing.JLabel coordinates
          +
        • +
        • +

          occupied_by

          +
          javax.swing.JLabel occupied_by
          +
        • +
        • +

          humidity

          +
          javax.swing.JLabel humidity
          +
        • +
        • +

          grasslevel

          +
          javax.swing.JLabel grasslevel
          +
        • +
        • +

          id

          +
          javax.swing.JLabel id
          +
        • +
        • +

          type

          +
          javax.swing.JLabel type
          +
        • +
        • +

          energy

          +
          javax.swing.JLabel energy
          +
        • +
        • +

          age

          +
          javax.swing.JLabel age
          +
        • +
        • +

          generation

          +
          javax.swing.JLabel generation
          +
        • +
        • +

          parent

          +
          javax.swing.JLabel parent
          +
        • +
        • +

          offspring

          +
          javax.swing.JLabel offspring
          +
        • +
        • +

          speed

          +
          javax.swing.JLabel speed
          +
        • +
        • +

          stamina

          +
          javax.swing.JLabel stamina
          +
        • +
        • +

          efficiency

          +
          javax.swing.JLabel efficiency
          +
        • +
        • +

          age_limit

          +
          javax.swing.JLabel age_limit
          +
        • +
        • +

          strength

          +
          javax.swing.JLabel strength
          +
        • +
        • +

          rep_energy

          +
          javax.swing.JLabel rep_energy
          +
        • +
        • +

          mat_age

          +
          javax.swing.JLabel mat_age
          +
        • +
        • +

          gestation

          +
          javax.swing.JLabel gestation
          +
        • +
        • +

          repr_rate

          +
          javax.swing.JLabel repr_rate
          +
        • +
        • +

          eyesight

          +
          javax.swing.JLabel eyesight
          +
        • +
        • +

          mut_rate

          +
          javax.swing.JLabel mut_rate
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.ProgramConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          logging

          +
          javax.swing.JCheckBox logging
          +
        • +
        • +

          debug

          +
          javax.swing.JCheckBox debug
          +
        • +
        • +

          verbose

          +
          javax.swing.JCheckBox verbose
          +
        • +
        • +

          analyse

          +
          javax.swing.JCheckBox analyse
          +
        • +
        • +

          apply

          +
          javax.swing.JButton apply
          +
        • +
        +
      • +
      +
    • +
    • + + +

      Class view.SimulationConfig extends javax.swing.JFrame implements Serializable

      +
        +
      • +

        Serialized Fields

        +
          +
        • +

          mainBox

          +
          javax.swing.Box mainBox
          +
        • +
        • +

          heading

          +
          javax.swing.JLabel heading
          +
        • +
        • +

          dimensions

          +
          javax.swing.JLabel dimensions
          +
        • +
        • +

          waterLabel

          +
          javax.swing.JLabel waterLabel
          +
        • +
        • +

          nCarnLabel

          +
          javax.swing.JLabel nCarnLabel
          +
        • +
        • +

          nHerbLabel

          +
          javax.swing.JLabel nHerbLabel
          +
        • +
        • +

          grassLabel

          +
          javax.swing.JLabel grassLabel
          +
        • +
        • +

          energyCarnLabel

          +
          javax.swing.JLabel energyCarnLabel
          +
        • +
        • +

          energyHerbLabel

          +
          javax.swing.JLabel energyHerbLabel
          +
        • +
        • +

          width

          +
          javax.swing.JTextField width
          +
        • +
        • +

          height

          +
          javax.swing.JTextField height
          +
        • +
        • +

          no_water_tiles

          +
          javax.swing.JTextField no_water_tiles
          +
        • +
        • +

          no_carnivores

          +
          javax.swing.JTextField no_carnivores
          +
        • +
        • +

          no_herbivores

          +
          javax.swing.JTextField no_herbivores
          +
        • +
        • +

          grassDensity

          +
          javax.swing.JTextField grassDensity
          +
        • +
        • +

          energyHerbivores

          +
          javax.swing.JTextField energyHerbivores
          +
        • +
        • +

          energyCarnivores

          +
          javax.swing.JTextField energyCarnivores
          +
        • +
        • +

          confirm

          +
          javax.swing.JButton confirm
          +
        • +
        • +

          showRestartDialog

          +
          boolean showRestartDialog
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100755 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/doc/javadoc/view/Display.html b/doc/javadoc/view/Display.html new file mode 100755 index 0000000..d832c65 --- /dev/null +++ b/doc/javadoc/view/Display.html @@ -0,0 +1,659 @@ + + + + + +Display + + + + + + + + + + + + +
+
view
+

Class Display

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • javax.swing.JComponent
        • +
        • +
            +
          • javax.swing.JPanel
          • +
          • +
              +
            • view.Display
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable
    +
    +
    +
    +
    public class Display
    +extends javax.swing.JPanel
    +implements javax.swing.Scrollable, java.awt.event.MouseListener
    +
    This class provides a graphical representation of the simulation.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JPanel

        +javax.swing.JPanel.AccessibleJPanel
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JComponent

        +javax.swing.JComponent.AccessibleJComponent
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private InfoBoxinfobox 
      private int[]size 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JComponent

        +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Display(int[] setSize) +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      InfoBoxgetInfoBox() +
      Return the current infobox instance
      +
      java.awt.DimensiongetPreferredScrollableViewportSize() 
      intgetScrollableBlockIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      booleangetScrollableTracksViewportHeight() 
      booleangetScrollableTracksViewportWidth() 
      intgetScrollableUnitIncrement(java.awt.Rectangle arg0, + int arg1, + int arg2) 
      voidmouseClicked(java.awt.event.MouseEvent click) 
      voidmouseEntered(java.awt.event.MouseEvent arg0) 
      voidmouseExited(java.awt.event.MouseEvent arg0) 
      voidmousePressed(java.awt.event.MouseEvent arg0) 
      voidmouseReleased(java.awt.event.MouseEvent arg0) 
      voidpaintComponent(java.awt.Graphics g) +
      Draw the current status of the simulation onto the panel.
      +
      voidupdate() +
      Update the display
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JPanel

        +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JComponent

        +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        size

        +
        private int[] size
        +
      • +
      + + + +
        +
      • +

        infobox

        +
        private InfoBox infobox
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Display

        +
        public Display(int[] setSize)
        +
        The constructor
        +
        +
        Parameters:
        +
        int[2] - size
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the display
        +
      • +
      + + + +
        +
      • +

        paintComponent

        +
        public void paintComponent(java.awt.Graphics g)
        +
        Draw the current status of the simulation onto the panel.
        +
        +
        Overrides:
        +
        paintComponent in class javax.swing.JComponent
        +
        +
      • +
      + + + +
        +
      • +

        getInfoBox

        +
        public InfoBox getInfoBox()
        +
        Return the current infobox instance
        +
      • +
      + + + +
        +
      • +

        mouseClicked

        +
        public void mouseClicked(java.awt.event.MouseEvent click)
        +
        +
        Specified by:
        +
        mouseClicked in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseEntered

        +
        public void mouseEntered(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseEntered in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseExited

        +
        public void mouseExited(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseExited in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mousePressed

        +
        public void mousePressed(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mousePressed in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        mouseReleased

        +
        public void mouseReleased(java.awt.event.MouseEvent arg0)
        +
        +
        Specified by:
        +
        mouseReleased in interface java.awt.event.MouseListener
        +
        +
      • +
      + + + +
        +
      • +

        getPreferredScrollableViewportSize

        +
        public java.awt.Dimension getPreferredScrollableViewportSize()
        +
        +
        Specified by:
        +
        getPreferredScrollableViewportSize in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableBlockIncrement

        +
        public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
        +                                       int arg1,
        +                                       int arg2)
        +
        +
        Specified by:
        +
        getScrollableBlockIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportHeight

        +
        public boolean getScrollableTracksViewportHeight()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportHeight in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableTracksViewportWidth

        +
        public boolean getScrollableTracksViewportWidth()
        +
        +
        Specified by:
        +
        getScrollableTracksViewportWidth in interface javax.swing.Scrollable
        +
        +
      • +
      + + + +
        +
      • +

        getScrollableUnitIncrement

        +
        public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
        +                                      int arg1,
        +                                      int arg2)
        +
        +
        Specified by:
        +
        getScrollableUnitIncrement in interface javax.swing.Scrollable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GUI.html b/doc/javadoc/view/GUI.html new file mode 100755 index 0000000..24fcc5c --- /dev/null +++ b/doc/javadoc/view/GUI.html @@ -0,0 +1,981 @@ + + + + + +GUI + + + + + + + + + + + + +
+
view
+

Class GUI

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GUI
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GUI
    +extends javax.swing.JFrame
    +
    This class is the main class of the view package. It combines all the different + GUI components required for the programme.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JMenuItemabout 
      private javax.swing.JLabelcarnivore_counter 
      private javax.swing.JFileChooserconfigChooser 
      private javax.swing.JMenuItemconfigFileDialog 
      private javax.swing.JMenuconfiguration 
      private javax.swing.JCheckBoxdisableDisplay 
      private Displaydisplay 
      private javax.swing.JMenuItemexit 
      private javax.swing.JMenufile 
      private javax.swing.JLabelgeneration_counter 
      private GenomeConfiggenomeConfig 
      private javax.swing.JMenuItemgenomeConfigBox 
      private javax.swing.JLabelgrass_counter 
      private javax.swing.JMenuItemhelp 
      private javax.swing.JMenuhelp_menu 
      private HelpWindowhelpWindow 
      private javax.swing.JLabelherbivore_counter 
      private javax.swing.JComboBox<java.lang.String>humidityChooser 
      private javax.swing.Boxinformation 
      private javax.swing.JMenuBarmenubar 
      private javax.swing.JMenuItemnew_run 
      private javax.swing.JButtonnext 
      private ProgramConfigprogramConfig 
      private javax.swing.JMenuItemprogramConfigBox 
      private javax.swing.JButtonrun 
      private javax.swing.JScrollPanescrollscreen 
      private javax.swing.JScrollPanescrollticker 
      private static longserialVersionUID 
      private javax.swing.JMenuItemsimConfigBox 
      private SimulationConfigsimulationConfig 
      private javax.swing.JSliderspeedSlider 
      private javax.swing.JTextFieldstopAtField 
      private javax.swing.JTextAreaticker 
      private javax.swing.JLabelupdate_counter 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GUI() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voidaddDisplay() +
      Add the actual display.
      +
      private voidaddInformationPanel() +
      Add the information panel at the side
      +
      private voidcreateMenu() +
      Add the menubar
      +
      voiddisplayNews() +
      Display news items on the ticker
      +
      voidreset() +
      Destroy all windows in preparation for a new run.
      +
      voidupdate() +
      Update the GUI.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serialVersionUID

        +
        private static final long serialVersionUID
        +
        +
        See Also:
        +
        Constant Field Values
        +
        +
      • +
      + + + +
        +
      • +

        information

        +
        private javax.swing.Box information
        +
      • +
      + + + +
        +
      • +

        menubar

        +
        private javax.swing.JMenuBar menubar
        +
      • +
      + + + +
        +
      • +

        file

        +
        private javax.swing.JMenu file
        +
      • +
      + + + +
        +
      • +

        configuration

        +
        private javax.swing.JMenu configuration
        +
      • +
      + + + +
        +
      • +

        help_menu

        +
        private javax.swing.JMenu help_menu
        +
      • +
      + + + +
        +
      • +

        new_run

        +
        private javax.swing.JMenuItem new_run
        +
      • +
      + + + +
        +
      • +

        exit

        +
        private javax.swing.JMenuItem exit
        +
      • +
      + + + +
        +
      • +

        programConfigBox

        +
        private javax.swing.JMenuItem programConfigBox
        +
      • +
      + + + +
        +
      • +

        simConfigBox

        +
        private javax.swing.JMenuItem simConfigBox
        +
      • +
      + + + +
        +
      • +

        genomeConfigBox

        +
        private javax.swing.JMenuItem genomeConfigBox
        +
      • +
      + + + +
        +
      • +

        configFileDialog

        +
        private javax.swing.JMenuItem configFileDialog
        +
      • +
      + + + +
        +
      • +

        help

        +
        private javax.swing.JMenuItem help
        +
      • +
      + + + +
        +
      • +

        about

        +
        private javax.swing.JMenuItem about
        +
      • +
      + + + +
        +
      • +

        update_counter

        +
        private javax.swing.JLabel update_counter
        +
      • +
      + + + +
        +
      • +

        herbivore_counter

        +
        private javax.swing.JLabel herbivore_counter
        +
      • +
      + + + +
        +
      • +

        carnivore_counter

        +
        private javax.swing.JLabel carnivore_counter
        +
      • +
      + + + +
        +
      • +

        generation_counter

        +
        private javax.swing.JLabel generation_counter
        +
      • +
      + + + +
        +
      • +

        grass_counter

        +
        private javax.swing.JLabel grass_counter
        +
      • +
      + + + +
        +
      • +

        humidityChooser

        +
        private javax.swing.JComboBox<java.lang.String> humidityChooser
        +
      • +
      + + + +
        +
      • +

        ticker

        +
        private javax.swing.JTextArea ticker
        +
      • +
      + + + +
        +
      • +

        stopAtField

        +
        private javax.swing.JTextField stopAtField
        +
      • +
      + + + +
        +
      • +

        disableDisplay

        +
        private javax.swing.JCheckBox disableDisplay
        +
      • +
      + + + +
        +
      • +

        scrollticker

        +
        private javax.swing.JScrollPane scrollticker
        +
      • +
      + + + +
        +
      • +

        scrollscreen

        +
        private javax.swing.JScrollPane scrollscreen
        +
      • +
      + + + +
        +
      • +

        run

        +
        private javax.swing.JButton run
        +
      • +
      + + + +
        +
      • +

        next

        +
        private javax.swing.JButton next
        +
      • +
      + + + +
        +
      • +

        speedSlider

        +
        private javax.swing.JSlider speedSlider
        +
      • +
      + + + +
        +
      • +

        display

        +
        private Display display
        +
      • +
      + + + + + + + + + + + + + + + +
        +
      • +

        configChooser

        +
        private javax.swing.JFileChooser configChooser
        +
      • +
      + + + +
        +
      • +

        helpWindow

        +
        private HelpWindow helpWindow
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GUI

        +
        public GUI()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        update

        +
        public void update()
        +
        Update the GUI.
        +
      • +
      + + + +
        +
      • +

        createMenu

        +
        private void createMenu()
        +
        Add the menubar
        +
      • +
      + + + +
        +
      • +

        addInformationPanel

        +
        private void addInformationPanel()
        +
        Add the information panel at the side
        +
      • +
      + + + +
        +
      • +

        addDisplay

        +
        private void addDisplay()
        +
        Add the actual display.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Destroy all windows in preparation for a new run.
        +
      • +
      + + + +
        +
      • +

        displayNews

        +
        public void displayNews()
        +
        Display news items on the ticker
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/GenomeConfig.html b/doc/javadoc/view/GenomeConfig.html new file mode 100755 index 0000000..60c9c11 --- /dev/null +++ b/doc/javadoc/view/GenomeConfig.html @@ -0,0 +1,702 @@ + + + + + +GenomeConfig + + + + + + + + + + + + +
+
view
+

Class GenomeConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.GenomeConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class GenomeConfig
    +extends javax.swing.JFrame
    +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JTextFieldageLimit 
      private javax.swing.JButtonconfirm 
      private javax.swing.JTextFieldgestation 
      private javax.swing.BoxmainBox 
      private javax.swing.JTextFieldmaturityAge 
      private javax.swing.JTextFieldmetabolism 
      private javax.swing.JTextFieldmutationRate 
      private javax.swing.JTextFieldreproductionRate 
      private javax.swing.JTextFieldreproductiveEnergy 
      private booleanshowRestartDialog 
      private javax.swing.JTextFieldsight 
      private javax.swing.JTextFieldspeed 
      private javax.swing.JTextFieldstamina 
      private javax.swing.JTextFieldstrength 
      private javax.swing.JComboBox<java.lang.String>typeChooser 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      GenomeConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddrawGenomeConfigWindow() +
      Create the interface
      +
      voidshowGenomeConfig(boolean showRestart) +
      Update the box and make it visible
      +
      private voidupdate() +
      Update all the text fields.
      +
      private voidupdateWorld() +
      Update the default genome values
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        typeChooser

        +
        private javax.swing.JComboBox<java.lang.String> typeChooser
        +
      • +
      + + + +
        +
      • +

        mutationRate

        +
        private javax.swing.JTextField mutationRate
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JTextField speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JTextField stamina
        +
      • +
      + + + +
        +
      • +

        sight

        +
        private javax.swing.JTextField sight
        +
      • +
      + + + +
        +
      • +

        metabolism

        +
        private javax.swing.JTextField metabolism
        +
      • +
      + + + +
        +
      • +

        ageLimit

        +
        private javax.swing.JTextField ageLimit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JTextField strength
        +
      • +
      + + + +
        +
      • +

        reproductiveEnergy

        +
        private javax.swing.JTextField reproductiveEnergy
        +
      • +
      + + + +
        +
      • +

        maturityAge

        +
        private javax.swing.JTextField maturityAge
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JTextField gestation
        +
      • +
      + + + +
        +
      • +

        reproductionRate

        +
        private javax.swing.JTextField reproductionRate
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GenomeConfig

        +
        public GenomeConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawGenomeConfigWindow

        +
        public void drawGenomeConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showGenomeConfig

        +
        public void showGenomeConfig(boolean showRestart)
        +
        Update the box and make it visible
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        private void update()
        +
        Update all the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        private void updateWorld()
        +
        Update the default genome values
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/HelpWindow.html b/doc/javadoc/view/HelpWindow.html new file mode 100755 index 0000000..4429912 --- /dev/null +++ b/doc/javadoc/view/HelpWindow.html @@ -0,0 +1,564 @@ + + + + + +HelpWindow + + + + + + + + + + + + +
+
view
+

Class HelpWindow

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.HelpWindow
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class HelpWindow
    +extends javax.swing.JFrame
    +
    This window displays the help file for Ecologia.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      (package private) javax.swing.Boxbutton_panel 
      (package private) javax.swing.JButtonconcepts 
      (package private) javax.swing.JButtonhelp 
      (package private) javax.swing.JButtonlicense 
      (package private) javax.swing.Boxmain_panel 
      (package private) javax.swing.JScrollPanescroller 
      (package private) javax.swing.JTextAreatext 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HelpWindow() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidcreateGUI() +
      Add the text area which will display the text and the buttons to choose + which text to display.
      +
      voidloadDocFile(java.lang.String filename) +
      Load a documentation file.
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        text

        +
        javax.swing.JTextArea text
        +
      • +
      + + + +
        +
      • +

        scroller

        +
        javax.swing.JScrollPane scroller
        +
      • +
      + + + +
        +
      • +

        main_panel

        +
        javax.swing.Box main_panel
        +
      • +
      + + + +
        +
      • +

        button_panel

        +
        javax.swing.Box button_panel
        +
      • +
      + + + +
        +
      • +

        help

        +
        javax.swing.JButton help
        +
      • +
      + + + +
        +
      • +

        concepts

        +
        javax.swing.JButton concepts
        +
      • +
      + + + +
        +
      • +

        license

        +
        javax.swing.JButton license
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HelpWindow

        +
        public HelpWindow()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createGUI

        +
        public void createGUI()
        +
        Add the text area which will display the text and the buttons to choose + which text to display.
        +
      • +
      + + + +
        +
      • +

        loadDocFile

        +
        public void loadDocFile(java.lang.String filename)
        +
        Load a documentation file.
        +
        +
        Parameters:
        +
        String - fileName
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/InfoBox.html b/doc/javadoc/view/InfoBox.html new file mode 100755 index 0000000..c13ba7c --- /dev/null +++ b/doc/javadoc/view/InfoBox.html @@ -0,0 +1,889 @@ + + + + + +InfoBox + + + + + + + + + + + + +
+
view
+

Class InfoBox

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.InfoBox
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class InfoBox
    +extends javax.swing.JFrame
    +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JLabelage 
      private javax.swing.JLabelage_limit 
      private javax.swing.Boxanimal_box 
      private java.util.HashMap<java.lang.String,java.lang.Integer>animalInfo 
      private javax.swing.JLabelcoordinates 
      private javax.swing.JLabelefficiency 
      private javax.swing.JLabelenergy 
      private javax.swing.JLabeleyesight 
      private javax.swing.JLabelgeneration 
      private javax.swing.JLabelgestation 
      private javax.swing.JLabelgrasslevel 
      private javax.swing.JLabelhumidity 
      private javax.swing.JLabelid 
      private javax.swing.JLabelmat_age 
      private javax.swing.JLabelmut_rate 
      private javax.swing.JLabeloccupied_by 
      private javax.swing.JLabeloffspring 
      private javax.swing.JLabelparent 
      private javax.swing.JLabelrep_energy 
      private javax.swing.JLabelrepr_rate 
      private javax.swing.JLabelspeed 
      private javax.swing.JLabelstamina 
      private javax.swing.JLabelstrength 
      private javax.swing.JTabbedPanetab_pane 
      private javax.swing.Boxtile_box 
      private javax.swing.JLabeltype 
      private intxtile 
      private intytile 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      InfoBox() +
      The constructor.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawAnimalBox() +
      Draw the animal box.
      +
      private voiddrawInfoBox() +
      Initialise the infobox.
      +
      private voiddrawTileBox() +
      Draw the tile box.
      +
      voidrefresh() +
      Refresh the Infobox with the data of a new tile.
      +
      voidshow(int tileX, + int tileY) +
      Displays the information about the specified tile
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        xtile

        +
        private int xtile
        +
      • +
      + + + +
        +
      • +

        ytile

        +
        private int ytile
        +
      • +
      + + + +
        +
      • +

        animalInfo

        +
        private java.util.HashMap<java.lang.String,java.lang.Integer> animalInfo
        +
      • +
      + + + +
        +
      • +

        tab_pane

        +
        private javax.swing.JTabbedPane tab_pane
        +
      • +
      + + + +
        +
      • +

        tile_box

        +
        private javax.swing.Box tile_box
        +
      • +
      + + + +
        +
      • +

        animal_box

        +
        private javax.swing.Box animal_box
        +
      • +
      + + + +
        +
      • +

        coordinates

        +
        private javax.swing.JLabel coordinates
        +
      • +
      + + + +
        +
      • +

        occupied_by

        +
        private javax.swing.JLabel occupied_by
        +
      • +
      + + + +
        +
      • +

        humidity

        +
        private javax.swing.JLabel humidity
        +
      • +
      + + + +
        +
      • +

        grasslevel

        +
        private javax.swing.JLabel grasslevel
        +
      • +
      + + + +
        +
      • +

        id

        +
        private javax.swing.JLabel id
        +
      • +
      + + + +
        +
      • +

        type

        +
        private javax.swing.JLabel type
        +
      • +
      + + + +
        +
      • +

        energy

        +
        private javax.swing.JLabel energy
        +
      • +
      + + + +
        +
      • +

        age

        +
        private javax.swing.JLabel age
        +
      • +
      + + + +
        +
      • +

        generation

        +
        private javax.swing.JLabel generation
        +
      • +
      + + + +
        +
      • +

        parent

        +
        private javax.swing.JLabel parent
        +
      • +
      + + + +
        +
      • +

        offspring

        +
        private javax.swing.JLabel offspring
        +
      • +
      + + + +
        +
      • +

        speed

        +
        private javax.swing.JLabel speed
        +
      • +
      + + + +
        +
      • +

        stamina

        +
        private javax.swing.JLabel stamina
        +
      • +
      + + + +
        +
      • +

        efficiency

        +
        private javax.swing.JLabel efficiency
        +
      • +
      + + + +
        +
      • +

        age_limit

        +
        private javax.swing.JLabel age_limit
        +
      • +
      + + + +
        +
      • +

        strength

        +
        private javax.swing.JLabel strength
        +
      • +
      + + + +
        +
      • +

        rep_energy

        +
        private javax.swing.JLabel rep_energy
        +
      • +
      + + + +
        +
      • +

        mat_age

        +
        private javax.swing.JLabel mat_age
        +
      • +
      + + + +
        +
      • +

        gestation

        +
        private javax.swing.JLabel gestation
        +
      • +
      + + + +
        +
      • +

        repr_rate

        +
        private javax.swing.JLabel repr_rate
        +
      • +
      + + + +
        +
      • +

        eyesight

        +
        private javax.swing.JLabel eyesight
        +
      • +
      + + + +
        +
      • +

        mut_rate

        +
        private javax.swing.JLabel mut_rate
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InfoBox

        +
        public InfoBox()
        +
        The constructor.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawInfoBox

        +
        private void drawInfoBox()
        +
        Initialise the infobox.
        +
      • +
      + + + +
        +
      • +

        drawTileBox

        +
        private void drawTileBox()
        +
        Draw the tile box.
        +
      • +
      + + + +
        +
      • +

        drawAnimalBox

        +
        private void drawAnimalBox()
        +
        Draw the animal box.
        +
      • +
      + + + +
        +
      • +

        show

        +
        public void show(int tileX,
        +                 int tileY)
        +
        Displays the information about the specified tile
        +
        +
        Parameters:
        +
        int - Tile coordinates
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh the Infobox with the data of a new tile.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/ProgramConfig.html b/doc/javadoc/view/ProgramConfig.html new file mode 100755 index 0000000..77f9487 --- /dev/null +++ b/doc/javadoc/view/ProgramConfig.html @@ -0,0 +1,595 @@ + + + + + +ProgramConfig + + + + + + + + + + + + +
+
view
+

Class ProgramConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.ProgramConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class ProgramConfig
    +extends javax.swing.JFrame
    +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JCheckBoxanalyse 
      private javax.swing.JButtonapply 
      private javax.swing.JCheckBoxdebug 
      private javax.swing.JLabelheading 
      private javax.swing.JCheckBoxlogging 
      private javax.swing.BoxmainBox 
      private javax.swing.JCheckBoxverbose 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ProgramConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() 
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig() +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        logging

        +
        private javax.swing.JCheckBox logging
        +
      • +
      + + + +
        +
      • +

        debug

        +
        private javax.swing.JCheckBox debug
        +
      • +
      + + + +
        +
      • +

        verbose

        +
        private javax.swing.JCheckBox verbose
        +
      • +
      + + + +
        +
      • +

        analyse

        +
        private javax.swing.JCheckBox analyse
        +
      • +
      + + + +
        +
      • +

        apply

        +
        private javax.swing.JButton apply
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ProgramConfig

        +
        public ProgramConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig()
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/SimulationConfig.html b/doc/javadoc/view/SimulationConfig.html new file mode 100755 index 0000000..008631a --- /dev/null +++ b/doc/javadoc/view/SimulationConfig.html @@ -0,0 +1,754 @@ + + + + + +SimulationConfig + + + + + + + + + + + + +
+
view
+

Class SimulationConfig

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.awt.Component
    • +
    • +
        +
      • java.awt.Container
      • +
      • +
          +
        • java.awt.Window
        • +
        • +
            +
          • java.awt.Frame
          • +
          • +
              +
            • javax.swing.JFrame
            • +
            • +
                +
              • view.SimulationConfig
              • +
              +
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    +
    +
    +
    +
    public class SimulationConfig
    +extends javax.swing.JFrame
    +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from class javax.swing.JFrame

        +javax.swing.JFrame.AccessibleJFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Frame

        +java.awt.Frame.AccessibleAWTFrame
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Window

        +java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Container

        +java.awt.Container.AccessibleAWTContainer
      • +
      +
        +
      • + + +

        Nested classes/interfaces inherited from class java.awt.Component

        +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      private javax.swing.JButtonconfirm 
      private javax.swing.JLabeldimensions 
      private javax.swing.JTextFieldenergyCarnivores 
      private javax.swing.JLabelenergyCarnLabel 
      private javax.swing.JTextFieldenergyHerbivores 
      private javax.swing.JLabelenergyHerbLabel 
      private javax.swing.JTextFieldgrassDensity 
      private javax.swing.JLabelgrassLabel 
      private javax.swing.JLabelheading 
      private javax.swing.JTextFieldheight 
      private javax.swing.BoxmainBox 
      private javax.swing.JLabelnCarnLabel 
      private javax.swing.JLabelnHerbLabel 
      private javax.swing.JTextFieldno_carnivores 
      private javax.swing.JTextFieldno_herbivores 
      private javax.swing.JTextFieldno_water_tiles 
      private booleanshowRestartDialog 
      private javax.swing.JLabelwaterLabel 
      private javax.swing.JTextFieldwidth 
      +
        +
      • + + +

        Fields inherited from class javax.swing.JFrame

        +accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Frame

        +CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • +
      +
        +
      • + + +

        Fields inherited from class java.awt.Component

        +BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • +
      +
        +
      • + + +

        Fields inherited from interface javax.swing.WindowConstants

        +DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
      • +
      +
        +
      • + + +

        Fields inherited from interface java.awt.image.ImageObserver

        +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimulationConfig() +
      The constructor
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      private voiddrawConfigWindow() +
      Create the interface
      +
      voidrefresh() +
      Refresh values displayed in the text fields.
      +
      voidshowConfig(boolean showRestart) +
      Show the configuration window
      +
      voidupdateWorld() +
      Extract all the settings from the text fields and update the world parameters
      +
      +
        +
      • + + +

        Methods inherited from class javax.swing.JFrame

        +addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Frame

        +addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Window

        +addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Container

        +add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • +
      +
        +
      • + + +

        Methods inherited from class java.awt.Component

        +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.awt.MenuContainer

        +getFont, postEvent
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        mainBox

        +
        private javax.swing.Box mainBox
        +
      • +
      + + + +
        +
      • +

        heading

        +
        private javax.swing.JLabel heading
        +
      • +
      + + + +
        +
      • +

        dimensions

        +
        private javax.swing.JLabel dimensions
        +
      • +
      + + + +
        +
      • +

        waterLabel

        +
        private javax.swing.JLabel waterLabel
        +
      • +
      + + + +
        +
      • +

        nCarnLabel

        +
        private javax.swing.JLabel nCarnLabel
        +
      • +
      + + + +
        +
      • +

        nHerbLabel

        +
        private javax.swing.JLabel nHerbLabel
        +
      • +
      + + + +
        +
      • +

        grassLabel

        +
        private javax.swing.JLabel grassLabel
        +
      • +
      + + + +
        +
      • +

        energyCarnLabel

        +
        private javax.swing.JLabel energyCarnLabel
        +
      • +
      + + + +
        +
      • +

        energyHerbLabel

        +
        private javax.swing.JLabel energyHerbLabel
        +
      • +
      + + + +
        +
      • +

        width

        +
        private javax.swing.JTextField width
        +
      • +
      + + + +
        +
      • +

        height

        +
        private javax.swing.JTextField height
        +
      • +
      + + + +
        +
      • +

        no_water_tiles

        +
        private javax.swing.JTextField no_water_tiles
        +
      • +
      + + + +
        +
      • +

        no_carnivores

        +
        private javax.swing.JTextField no_carnivores
        +
      • +
      + + + +
        +
      • +

        no_herbivores

        +
        private javax.swing.JTextField no_herbivores
        +
      • +
      + + + +
        +
      • +

        grassDensity

        +
        private javax.swing.JTextField grassDensity
        +
      • +
      + + + +
        +
      • +

        energyHerbivores

        +
        private javax.swing.JTextField energyHerbivores
        +
      • +
      + + + +
        +
      • +

        energyCarnivores

        +
        private javax.swing.JTextField energyCarnivores
        +
      • +
      + + + +
        +
      • +

        confirm

        +
        private javax.swing.JButton confirm
        +
      • +
      + + + +
        +
      • +

        showRestartDialog

        +
        private boolean showRestartDialog
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimulationConfig

        +
        public SimulationConfig()
        +
        The constructor
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        drawConfigWindow

        +
        private void drawConfigWindow()
        +
        Create the interface
        +
      • +
      + + + +
        +
      • +

        showConfig

        +
        public void showConfig(boolean showRestart)
        +
        Show the configuration window
        +
        +
        Parameters:
        +
        showRestart - Show the restart dialog when closing this window?
        +
        +
      • +
      + + + +
        +
      • +

        refresh

        +
        public void refresh()
        +
        Refresh values displayed in the text fields.
        +
      • +
      + + + +
        +
      • +

        updateWorld

        +
        public void updateWorld()
        +
        Extract all the settings from the text fields and update the world parameters
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/view/package-frame.html b/doc/javadoc/view/package-frame.html new file mode 100755 index 0000000..acd802f --- /dev/null +++ b/doc/javadoc/view/package-frame.html @@ -0,0 +1,26 @@ + + + + + +view + + + + + +

view

+ + + diff --git a/doc/javadoc/view/package-summary.html b/doc/javadoc/view/package-summary.html new file mode 100755 index 0000000..8a300f5 --- /dev/null +++ b/doc/javadoc/view/package-summary.html @@ -0,0 +1,195 @@ + + + + + +view + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Package view

+
+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Display +
    This class provides a graphical representation of the simulation.
    +
    GenomeConfig +
    This class provides GUI configuration facilities + for setting default genome values.
    +
    GUI +
    This class is the main class of the view package.
    +
    HelpWindow +
    This window displays the help file for Ecologia.
    +
    InfoBox +
    This class is responsible for displaying information about a tile that was + clicked on in the simulator.
    +
    ProgramConfig +
    This class provides a GUI to configure program options (these can + also be set via commandline flags).
    +
    SimulationConfig +
    This class is used to graphically configure simulation parameters + prior to the start of a run.
    +
    +
  • +
+ + + +

Package view Description

+
view is responsible for displaying the current status of the simulation and + provides a graphical user interface.
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/javadoc/view/package-tree.html b/doc/javadoc/view/package-tree.html new file mode 100755 index 0000000..9845e1e --- /dev/null +++ b/doc/javadoc/view/package-tree.html @@ -0,0 +1,171 @@ + + + + + +view Class Hierarchy + + + + + + + + +
+ + + + + + + +
Ecologia
+
+ + +
+

Hierarchy For Package view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) +
              +
            • view.Display (implements java.awt.event.MouseListener, javax.swing.Scrollable)
            • +
            +
          • +
          +
        • +
        • java.awt.Window (implements javax.accessibility.Accessible) + +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+ +
+ + + + + + + +
Ecologia
+
+ + + + diff --git a/doc/make_javadoc.sh b/doc/make_javadoc.sh new file mode 100755 index 0000000..ae53923 --- /dev/null +++ b/doc/make_javadoc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Create the Javadoc(tm) for the Ecologia project. +# @author Daniel Vedder +# @date 13/1/2015 + +echo "Deleting old Javadoc..." +rm -r javadoc/* + +# Set variables +DOC_TITLE='Ecologia Documentation' +HEADER='Ecologia' +PACKAGES='main model view controller' + +echo "Creating Javadoc..." +javadoc -sourcepath ../src \ + -doctitle $DOC_TITLE \ + -header $HEADER \ + -d javadoc \ + -private \ + -quiet \ + $PACKAGES + +ln -s javadoc/index.html javadoc.html + +echo "Done." diff --git a/doc/roadmap b/doc/roadmap new file mode 100755 index 0000000..691e5bb --- /dev/null +++ b/doc/roadmap @@ -0,0 +1,38 @@ +ECOLOGIA Roadmap +================ + + +Ecologia 1.0 (Base): + +The basic Ecologia set-up, with herbivores, carnivores and water tiles. Simple +and stable, the basis for future scenario branches. + + +Scenario branches: + +Branches introducing new concepts to Ecologia Base, e.g. seasons, disease, +sexual reproduction, new species... + + +Ecologia X: + +The grand amalgamation of all scenarios. A complex ecosystem simulation +including many different factors. + + + Ecologia X >> + /======================================== ... + // // // + // Scenario branches // // + // v | // // + /===================+=========/ // + [now] // v // +Ecologia Ecologia /=====================================/ + 0.9 1.0 // + v v // Ecologia Base Branch >> +===================================================================== ... + +24/12/2014 +updated 18/05/2016 + +Daniel Vedder diff --git a/release.py b/release.py new file mode 100755 index 0000000..c610a24 --- /dev/null +++ b/release.py @@ -0,0 +1,118 @@ +#!/usr/bin/python3 +''' +Package Ecologia ready for release: +- create an executable JAR +- create/update Javadoc +- package source and binaries +- sign tar archive +- create checksum + +Note: this script is Linux (and maybe Bash) specific! + +@author Daniel Vedder +@version 14/03/2015 +''' + +import os +import sys + +''' +Extract the version number from the main file +''' +def find_version(): + main_file = open("src/main/Ecologia.java") + main_source = main_file.read() + main_file.close() + version_start = main_source.find("version = ")+11 + version_end = main_source.find('"', version_start) + return main_source[version_start:version_end] + +''' +Create an executable JAR file +''' +def create_jar(package_name): + #compile all Java source files + if "bin" not in os.listdir(os.getcwd()): os.mkdir("bin") + os.system("rm -r bin/*") + source_list = "" + for package in os.listdir("src"): + for jsrc in os.listdir("src/"+package): + source_list = source_list+" src/"+package+"/"+jsrc + os.system("javac -d bin "+source_list) + #copy the newest documentation files into the binary folder + os.mkdir("bin/doc") + os.system("cp doc/help bin/doc") + os.system("cp doc/concepts bin/doc") + os.system("cp doc/COPYING bin/doc") + #create the JAR file + try: + manifest_file = open("MANIFEST.MF", "w") + manifest_text = "Class-Path: .\nMain-Class: main.Ecologia" + manifest_file.write(manifest_text) + manifest_file.close() + except IOError: + print("Failed to create JAR manifest file!") + jar_command = "jar cfme "+package_name+""".jar MANIFEST.MF main.Ecologia \ +-C bin main -C bin model -C bin controller -C bin view -C bin doc""" + os.system(jar_command) + os.system("rm MANIFEST.MF") + +''' +Create the release archive and package all necessary files +''' +def package_files(package_name): + os.mkdir(package_name) + #XXX How do I make sure the analysis folder contains only the scripts? + files = ["src", "doc", "analysis", package_name+".jar", "README", "release.py"] + for f in files: + os.system("cp -r "+f+" "+package_name) + if "--zip" in sys.argv: + os.system("zip -r "+package_name+".zip "+package_name) + else: + os.system("tar czf "+package_name+".tar.gz "+package_name) + os.system("rm -r "+package_name) + +''' +Prepare the release files +''' +def release(): + print("Preparing to package release...") + version = find_version() + print("Identified version "+version) + package_name = "ecologia-"+version + if not "--no-javadoc" in sys.argv: + print("Creating Javadoc...") + os.chdir("doc") + os.system("./make_javadoc.sh") + os.chdir("..") + print("Creating JAR file...") + create_jar(package_name) + print("Packaging files...") + package_files(package_name) + if not "--zip" in sys.argv and not "--no-sign" in sys.argv: + print("Creating checksum...") + os.system("sha256sum "+package_name+".tar.gz > "+package_name+".tar.gz.sha256sum") + print("Creating signature...") + os.system("gpg --armor --sign --detach-sig "+package_name+".tar.gz") + print("Finishing...") + if "releases" not in os.listdir(os.getcwd()): + os.mkdir("releases") + if package_name in os.listdir("releases"): + os.system("rm -r releases/"+package_name) + os.mkdir("releases/"+package_name) + os.system("mv "+package_name+"* releases/"+package_name) + print("Done.") + +def print_help(): + print("This is the Ecologia release script.\n") + print("Accepted commandline parameters:") + print("\t--help -h") + print("\t--zip") + print("\t--no-sign") + print("\t--no-javadoc") + print("\nFor more details, please read the source.\n") + +if __name__ == '__main__': + if "--help" in sys.argv or "-h" in sys.argv: + print_help() + else: release() diff --git a/src/controller/Humidity.java b/src/controller/Humidity.java new file mode 100755 index 0000000..57c4b53 --- /dev/null +++ b/src/controller/Humidity.java @@ -0,0 +1,80 @@ +package controller; + +import main.EcologiaIO; + +/** + * The different levels of humidity that are available. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public enum Humidity +{ + SEVERE_DROUGHT, + DROUGHT, + DRY, + WET, + SATURATION; + + /** + * Return the numerical value of an entry. + */ + public int getValue() + { + switch (this) { + case SEVERE_DROUGHT: return -2; + case DROUGHT: return -1; + case DRY: return 0; + case WET: return 1; + case SATURATION: return 2; + default: return 0; + } + } + + /** + * Return the string representation of an entry. + */ + public String getString() + { + switch (this) { + case SEVERE_DROUGHT: return "Severe Drought"; + case DROUGHT: return "Drought"; + case DRY: return "Dry"; + case WET: return "Wet"; + case SATURATION: return "Saturation"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Convert an integer into an enum entry + */ + public static Humidity fromString(String value) + { + switch(value) { + case "Severe Drought": return Humidity.SEVERE_DROUGHT; + case "Drought": return Humidity.DROUGHT; + case "Dry": return Humidity.DRY; + case "Wet": return Humidity.WET; + case "Saturation": return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.fromString()!"); return Humidity.DRY; + } + } + + /** + * Convert a number into an enum entry. + * @param int value + * @return Humidity + */ + public static Humidity getStatus(int value) + { + switch(value) { + case -2: return Humidity.SEVERE_DROUGHT; + case -1: return Humidity.DROUGHT; + case 0: return Humidity.DRY; + case 1: return Humidity.WET; + case 2: return Humidity.SATURATION; + default: EcologiaIO.error("Invalid value entered in Humidity.getStatus()!"); return Humidity.DRY; + } + } +} diff --git a/src/controller/OccupantType.java b/src/controller/OccupantType.java new file mode 100755 index 0000000..6014e70 --- /dev/null +++ b/src/controller/OccupantType.java @@ -0,0 +1,71 @@ +package controller; + +/** + * This is a list of all the possible elements that can occupy a field. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public enum OccupantType +{ + NONE, + HERBIVORE, + CARNIVORE, + WATER; + + /** + * Convert an enum entry to an integer + */ + public int toInt() + { + switch (this) { + case NONE: return 0; + case HERBIVORE: return 1; + case CARNIVORE: return 2; + case WATER: return 3; + default: return -1; //Cannot be called + } + } + + /** + * Convert the corresponding enum entry for this integer + */ + public static OccupantType fromInt(int i) + { + switch (i) { + case 1: return HERBIVORE; + case 2: return CARNIVORE; + case 3: return WATER; + default: return NONE; + } + } + + /** + * Return the string representation of an entry. + * + * @override toString() in Object + */ + public String toString() + { + switch (this) { + case NONE: return "None"; + case HERBIVORE: return "Herbivore"; + case CARNIVORE: return "Carnivore"; + case WATER: return "Water"; + default: return "N/A"; //Cannot be called + } + } + + /** + * Transform a string into an occupant type + */ + public static OccupantType fromString(String s) + { + switch (s) { + case "Herbivore": return HERBIVORE; + case "Carnivore": return CARNIVORE; + case "Water": return WATER; + default: return NONE; + } + } +} diff --git a/src/controller/World.java b/src/controller/World.java new file mode 100755 index 0000000..4acb5f3 --- /dev/null +++ b/src/controller/World.java @@ -0,0 +1,450 @@ +package controller; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import main.EcologiaIO; +import model.Carnivore; +import model.Genome; +import model.Herbivore; +import model.Simulator; + +/** + * The World class acts as a communicator between the model and the view packages. It receives + * the current status of the simulation from model and passes it on to view. Conversely, user + * input from view is forwarded to model. It also stores all simulation settings. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class World +{ + private static World world; //The Singleton instance of this class + + //Parameter variables + private int[] size; //The size of the world (x*y) + private int timelapse; //When running, the simulation will be updated every so many milliseconds. + private int stopAt; //The simulation will stop once this update is reached. + private int autorun; //The number of updates the simulation will run for automatically before quitting + private Humidity humidity; //The humidity level + private int startGrassDensity; //The initial grass density on all fields + private int waterTiles; //The number of water tiles that will be created. + private int startNoCarnivores, startNoHerbivores; //The starting number of carnivores/herbivores. + private int startEnergyCarnivores, startEnergyHerbivores; //The starting energy for carnivores/herbivores. + + //Runtime variables + private boolean running; //Is the simulation running? + private int turn; //The update number + private int nextID; //The next ID number that will be handed out to a newborn animal + private int herbivoreCounter, carnivoreCounter; //Keep count of the herbivores and carnivores + private int highestGeneration; //What generation have we reached by now? + private int averageGrassDensity; //A measure of how much food is available for the herbivores + private ArrayList> animals; //A list of properties of each animal + private ArrayList news; //A collection of news items that have accumulated + + /** + * This class implements Singleton, therefore the constructor is private. + */ + private World() + { + //Parameter settings + size = new int[] {100, 100}; //Default: 100*100 + timelapse = 100; //Default: 300 - can be changed at run-time + stopAt = 200; //Default: 100 - can be changed at run-time + autorun = -1; //Default: -1 (off) + waterTiles = 10; //Default: 10 + humidity = Humidity.WET; //Default: Humidity.WET - can be changed at run-time + startGrassDensity = 100; //Default: 100 + startNoCarnivores = 50; //Default: 50 - Hypothetical ideal: 5 (?) + startNoHerbivores = 200; //Default: 200 - Hypothetical ideal: 160 (?) + startEnergyCarnivores = 150; //Default: 150 + startEnergyHerbivores = 100; //Default: 100 + + reset(); //Runtime variables + } + + /** + * The Singleton method. + */ + public static World getInstance() + { + if (world == null) { + world = new World(); + } + return world; + } + + /** + * Read and parse a config file. + * XXX This is really messy, but it works. + */ + public void readConfigFile(String filename) + { + EcologiaIO.debug("Beginning to read config file "+filename); + try { + BufferedReader confReader = new BufferedReader(new FileReader(filename)); + String line = confReader.readLine(); + //Initialize some necessary helper variables + String section = ""; + String var = ""; + int value = -1; + HashMap herbGen = getDefaultGenome(OccupantType.HERBIVORE); + HashMap carnGen = getDefaultGenome(OccupantType.CARNIVORE); + //Inspect each line + while (line != null) { + //Split lines into variable/value pairs + line = line.trim(); + if (!line.startsWith("#")) { //Ignore commented lines + String[] elements = line.split(" "); + if (elements.length >= 2) { + var = elements[0].trim(); + try { + value = new Integer(elements[1].trim()); + } + catch (NumberFormatException nfe) { + EcologiaIO.error("Invalid integer for configuration variable "+var, nfe); + return; + } + } + } + //Set the current section + if (line.startsWith("[") && line.endsWith("]")) section = line; + //Deal with world variables + else if (section.equals("[world]")) { + switch (var) { + case "width": size[0] = value; break; + case "height": size[1] = value; break; + case "timelapse": timelapse = value; break; + case "stopAt": stopAt = value; break; + case "autorun": autorun = value; break; + case "waterTiles": waterTiles = value; break; + case "humidity": humidity = Humidity.getStatus(value); break; + case "startGrassDensity": startGrassDensity = value; break; + case "startHerbivores": startNoHerbivores = value; break; + case "startCarnivores": startNoCarnivores = value; break; + case "startEnergyHerbivores": startEnergyHerbivores = value; break; + case "startEnergyCarnivores": startEnergyCarnivores = value; break; + default: EcologiaIO.error("Invalid config variable in the [world] section: "+var); + } + } + //Configure default animal genomes + else if (section.equals("[herbivore]")) { + if (herbGen.containsKey(var)) herbGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [herbivore] section: "+var); + } + else if (section.equals("[carnivore]")) { + if (carnGen.containsKey(var)) carnGen.put(var, value); + else EcologiaIO.error("Invalid config variable in the [carnivore] section: "+var); + } + line = confReader.readLine(); + } + //Wrap up + confReader.close(); + Herbivore.defaultGenome = new Genome(herbGen); + Carnivore.defaultGenome = new Genome(carnGen); + EcologiaIO.log("Parsed config file "+filename); + } + catch (IOException ioe) { + EcologiaIO.error("Failed to read config file "+filename, ioe); + } + } + + /** + * Reset the world run-time variables, ready for a new run. + * This method should only be called from the Ecologia main class! + */ + public void reset() + { + running = false; + turn = 0; + nextID = 0; + herbivoreCounter = 0; + carnivoreCounter = 0; + highestGeneration = 1; + averageGrassDensity = startGrassDensity; + animals = null; + news = new ArrayList(); + } + + /** + * Display a news item - calling with null as a parameter resets the news list + * @param news + */ + public void giveNews(String message) + { + if (message == null) { + news.clear(); + } + else { + message = turn+": "+message; + news.add(message); + EcologiaIO.log(message); + } + } + + /** + * Return information about the animal at the given position as a hash map + * @param x, y + * @return HashMap, or null if no animal at the specified location + */ + public HashMap getAnimalInfo(int x, int y) + { + HashMap info = null; + for (int a = 0; a < animals.size(); a++) { + if (animals.get(a).get("X") == x && animals.get(a).get("Y") == y) { + info = animals.get(a); + break; + } + } + return info; + } + + /** + * Return information about the map field at the given position as a hash map + * @param x, y + * @return HashMap, or null if out of bounds + */ + public HashMap getFieldInfo(int x, int y) + { + return Simulator.getField(x, y).getInfo(); + } + + /* + * All the getters and setters for the parameter settings and runtime variables + */ + + /** + * Return a hash map holding all the genome values + */ + public HashMap getDefaultGenome(OccupantType type) + { + if (type == OccupantType.HERBIVORE) return Herbivore.defaultGenome.asHashMap(); + else if (type == OccupantType.CARNIVORE) return Carnivore.defaultGenome.asHashMap(); + else { + EcologiaIO.error("Invalid OccupantType passed to World.getDefaultGenome()", + EcologiaIO.FATAL_ERROR); + return null; + } + } + + /** + * Interface for the Genome method + */ + 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) + { + Genome genome = new Genome(mutationRate, speed, stamina, sight, metabolism, + ageLimit, strength, reproductiveEnergy, maturityAge, + gestation, reproductionRate); + if (type == OccupantType.HERBIVORE) Herbivore.defaultGenome = genome; + else if (type == OccupantType.CARNIVORE) Carnivore.defaultGenome = genome; + } + + public int[] getSize() + { + return size; + } + + public void setSize(int[] size) + { + this.size = size; + } + + public int getTimelapse() + { + return timelapse; + } + + public void setTimelapse(int timelapse) + { + if (timelapse < 0) return; + if (this.timelapse != timelapse) + EcologiaIO.debug("Timelapse changed to "+timelapse+" ms."); + this.timelapse = timelapse; + } + + public int getStopAt() + { + return stopAt; + } + + public void setStopAt(int stopAt) + { + this.stopAt = stopAt; + } + + public int getAutorun() + { + return autorun; + } + + public void setAutorun(int autorun) + { + this.autorun = autorun; + } + + public Humidity getHumidity() + { + return humidity; + } + + public void setHumidity(Humidity humidity) + { + this.humidity = humidity; + } + + public int getStartGrassDensity() + { + return startGrassDensity; + } + + public void setStartGrassDensity(int startGrassDensity) + { + this.startGrassDensity = startGrassDensity; + } + + public int getWaterTiles() + { + return waterTiles; + } + + public void setStartNoWaterTiles(int startNoWaterTiles) + { + this.waterTiles = startNoWaterTiles; + } + + public int getStartNoCarnivores() + { + return startNoCarnivores; + } + + public void setStartNoCarnivores(int startNoCarnivores) + { + this.startNoCarnivores = startNoCarnivores; + } + + public int getStartNoHerbivores() + { + return startNoHerbivores; + } + + public void setStartNoHerbivores(int startNoHerbivores) + { + this.startNoHerbivores = startNoHerbivores; + } + + public int getStartEnergyCarnivores() + { + return startEnergyCarnivores; + } + + public void setStartEnergyCarnivores(int startEnergyCarnivores) + { + this.startEnergyCarnivores = startEnergyCarnivores; + } + + public int getStartEnergyHerbivores() + { + return startEnergyHerbivores; + } + + public void setStartEnergyHerbivores(int startEnergyHerbivores) + { + this.startEnergyHerbivores = startEnergyHerbivores; + } + + public int getHerbivoreCount() + { + return herbivoreCounter; + } + + public void setHerbivoreCount(int herbivoreCounter) + { + this.herbivoreCounter = herbivoreCounter; + } + + public int getCarnivoreCount() + { + return carnivoreCounter; + } + + public void setCarnivoreCount(int carnivoreCounter) + { + this.carnivoreCounter = carnivoreCounter; + } + + public int getAverageGrassDensity() + { + return averageGrassDensity; + } + + public void setAverageGrassDensity(int averageGrassDensity) + { + this.averageGrassDensity = averageGrassDensity; + } + + public boolean isRunning() + { + return running; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + public int getTurn() + { + return turn; + } + + /** + * Increment the turn variable by one. + */ + public void incrementTurn() + { + turn++; + } + + /** + * Get the next unique animal ID number and increment the counter. + */ + public int getNextID() + { + nextID++; + if (nextID == Integer.MAX_VALUE) + EcologiaIO.error("Animal ID number integer overflow!", + EcologiaIO.BREAK_ERROR); + return nextID; + } + + /** + * Increment the generation counter as necessary. + */ + public void incGeneration(int n) + { + if (n > highestGeneration) { + highestGeneration = n; + } + } + + public int getGeneration() + { + return highestGeneration; + } + + public void setAnimals(ArrayList> animalInfo) + { + animals = animalInfo; + } + + public ArrayList collectNews() + { + return news; + } +} diff --git a/src/controller/package-info.java b/src/controller/package-info.java new file mode 100755 index 0000000..132bd77 --- /dev/null +++ b/src/controller/package-info.java @@ -0,0 +1,8 @@ +/** + * controller handles all communication between model and view. + * It stores a current snapshot of the simulation. + * + * @author Daniel Vedder + * + */ +package controller; \ No newline at end of file diff --git a/src/main/EcoTest.java b/src/main/EcoTest.java new file mode 100755 index 0000000..6d456d4 --- /dev/null +++ b/src/main/EcoTest.java @@ -0,0 +1,119 @@ +package main; + +import controller.*; +import model.*; + +/** + * This class is used to test new features in Ecologia during development. + * Only executes when in debugging is turned on and the testing variable + * (below) is set to true. + * + * TODO: expand this into a proper testing framework? + * + * @author Daniel Vedder + * @date 24.12.2014 + */ +public class EcoTest +{ + private boolean testing; + + int tpcX, tpcY; + + public EcoTest() + { + testing = false; //Is a test supposed to be run? + } + + /** + * Run a test (called first thing every update by the main class when in debug mode) + */ + public void runTest() + { + if (testing) { + EcologiaIO.debug("Ecotest: running test..."); + //Insert a test method here >>> + reproduceMidwinter(); + } + } + + /** + * Try and reproduce the Midwinter bug (random freezing) + */ + public void reproduceMidwinter() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Ecotest: Creating a herbivore at (1, 0)"); + Herbivore herbivore = new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, -1, 1, 0, + World.getInstance().getStartEnergyHerbivores(), 0); + Simulator.addAnimal(herbivore); + EcologiaIO.debug("Ecotest: Creating a carnivore at (1, 3)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, 1, 3, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + if (turn == 2) { + Simulator.getAnimal(1, 3).move(Direction.UP); + EcologiaIO.debug("Ecotest: herbivore at (1, 0) should flee up -> freeze"); + EcologiaIO.debug("Ecotest: Midwinter bug is fixed, so no more ice ;-)"); + } + } + + /** + * Does reproduction work? + */ + public void reproductionTest() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + EcologiaIO.debug("Creating a carnivore at (1, 1) with 301 energy"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -2, 1, 1, 301, 0); + Simulator.addAnimal(carnivore); + } + if (turn == 25) { + EcologiaIO.debug("Carnivore at (1, 1) should reproduce..."); + } + } + + /** + * Test the new setup of the news ticker. + */ + public void newsTest() + { + EcologiaIO.debug("Testing news ticker..."); + World.getInstance().giveNews("Testing 123..."); + } + + /** + * Add, move and remove an animal + */ + public void testPopulationChanges() + { + int turn = World.getInstance().getTurn(); + if (turn == 1) { + tpcX = 0; + tpcY = 0; + EcologiaIO.debug("Creating a carnivore at (0, 0)"); + Carnivore carnivore = new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, -1, tpcX, tpcY, + World.getInstance().getStartEnergyCarnivores(), 0); + Simulator.addAnimal(carnivore); + } + else if (turn < 5 && turn > 1) { + Animal carnivore = Simulator.getAnimal(tpcX, tpcY); + if (!carnivore.move(Direction.BOTTOM_RIGHT)) { + EcologiaIO.debug("Failed to move!"); + } + tpcX = carnivore.getX(); + tpcY = carnivore.getY(); + EcologiaIO.debug("Carnivore is moving right and down to ("+tpcX+", "+tpcY+")"); + } + else if (turn == 5) { + EcologiaIO.debug("Deleting carnivore at ("+tpcX+", "+tpcY+")"); + Simulator.removeAnimal(tpcX, tpcY, OccupantType.CARNIVORE); + } + } +} diff --git a/src/main/Ecologia.java b/src/main/Ecologia.java new file mode 100755 index 0000000..4d1ed75 --- /dev/null +++ b/src/main/Ecologia.java @@ -0,0 +1,241 @@ +package main; + +import controller.World; +import view.GUI; +import model.Simulator; + +/** + * Ecologia is a relatively simple ecosystem simulator, designed to show basic + * relationships between predators, prey and producers. + * + * Copyright (C) 2014-2016 Daniel Vedder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * This is the main class, which launches the application and acts as a + * manager, updating the program each round. + * + * @author Daniel Vedder + * @version 28.8.2014 + */ +public class Ecologia implements Runnable +{ + public static Ecologia eco; //The singleton object + public static final String version = "1.1"; + + private static boolean noGUI = false; + + private GUI gui; + private Simulator simulator; + private EcoTest tester; + + private Thread runningThread; + + /** + * Launch the program. + * see printHelp() for possible arguments + */ + public static void main(String[] args) + { + //Parse commandline arguments + int i = 0; + String a; + while (i < args.length) { + a = args[i]; + if (a.equals("--version") || a.equals("-V")) { + System.out.println("Ecologia "+version); + System.exit(0); + } + else if (a.equals( "--help") || a.equals("-h")) { + printHelp(); + System.exit(0); + } + else if (a.equals("--logging") || a.equals("-l")) + EcologiaIO.logging = true; + else if (a.equals("--verbose") || a.equals("-v")) + EcologiaIO.verbose = true; + else if (a.equals("--debug") || a.equals("-d")) + EcologiaIO.debugging = true; + else if (a.equals("--analyse") || a.equals("-a")) + EcologiaIO.analysing = true; + else if (a.equals("--no-graphics")) + noGUI = true; + else if (a.equals("--autorun")) { + World.getInstance().setAutorun(new Integer(args[i+1])); + i++; + } + else if (a.equals("--config")) { + World.getInstance().readConfigFile(args[i+1]); + i++; + } + else if (a.equals("--timelapse")) { + World.getInstance().setTimelapse(new Integer(args[i+1])); + i++; + } + else EcologiaIO.error("Invalid commandline parameter: "+a); + i++; + } + + //Set up logging + if (EcologiaIO.logging) EcologiaIO.archiveLog(); + EcologiaIO.printStatus(); + + //Only use no-graphics mode when on autorun + if (noGUI && (World.getInstance().getAutorun() < 0)) { + EcologiaIO.error("Returning to graphics mode as autorun not enabled."); + noGUI = false; + } + else if (noGUI) EcologiaIO.log("Running in no-graphics mode."); + + //Create an instance + eco = new Ecologia(); + } + + /** + * The Singleton method. + */ + public static Ecologia getInstance() + { + return eco; + } + + /** + * Ecologia implements Singleton, so the constructor is private. + */ + private Ecologia() + { + EcologiaIO.log("Launching Ecologia..."); + simulator = new Simulator(); + if (!noGUI) gui = new GUI(); + tester = new EcoTest(); + EcologiaIO.debug("Launch completed."); + if (World.getInstance().getAutorun() > 0) autorun(); + } + + /** + * Perform an automatic run. + */ + private void autorun() + { + EcologiaIO.log("Performing autorun for "+World.getInstance().getAutorun()+" updates."); + World.getInstance().setStopAt(-1); + startThread(); + } + + /** + * Reset the simulator in order to start a new run. + * + * XXX: Depending on how long the simulation has already + * been running, this can take quite a long time. + */ + public void reset() + { + EcologiaIO.archiveLog(); + EcologiaIO.log("Resetting Ecologia..."); + World.getInstance().reset(); + simulator = null; + simulator = new Simulator(); + if (!noGUI) { + gui.reset(); + gui = null; + gui = new GUI(); + gui.update(); + } + } + + /** + * Start the simulation. + */ + public void startThread() + { + World.getInstance().setRunning(true); + runningThread = new Thread(this); + runningThread.start(); + } + + /** + * Run the simulation. + */ + public void run() + { + World.getInstance().giveNews("Simulation is running."); + while (World.getInstance().isRunning()) { + iterate(); + } + World.getInstance().giveNews("Simulation has stopped."); + if (!noGUI) gui.update(); //Make sure the above news is displayed by the GUI + } + + /** + * Perform one iteration of the simulation. + */ + public synchronized void iterate() + { + int autorun = World.getInstance().getAutorun(); + World.getInstance().incrementTurn(); + int turn = World.getInstance().getTurn(); + EcologiaIO.log("Executing update "+turn); + if (EcologiaIO.debugging) tester.runTest(); + simulator.update(); + EcologiaIO.log("Average grass density: "+World.getInstance().getAverageGrassDensity()+"%"); + EcologiaIO.log("Herbivore count: "+World.getInstance().getHerbivoreCount()); + EcologiaIO.log("Carnivore count: "+World.getInstance().getCarnivoreCount()); + EcologiaIO.log("Generation counter: "+World.getInstance().getGeneration()); + + //If the stopAt number is reached, pause the simulation + if (World.getInstance().getStopAt() == turn) { + World.getInstance().setRunning(false); + } + if (!noGUI) gui.update(); + //Stop the simulation if there are no more animals + if (World.getInstance().getCarnivoreCount() == 0 && + World.getInstance().getHerbivoreCount() == 0) { + World.getInstance().setRunning(false); + if (autorun > 0) turn = autorun; + else return; + } + //Check if an autorun has completed + if (turn == autorun) { + EcologiaIO.log("Completed autorun, shutting down."); + System.exit(0); + } + //Pause for as long as the user wants + try { + Thread.sleep(World.getInstance().getTimelapse()); + } + catch (InterruptedException ie) {} + } + + /** + * Print a short help text when invoked from the commandline + */ + private static void printHelp() + { + System.out.println("Ecologia "+version+", the simple ecosystem simulator."); + System.out.println("\nCommandline options:\n"); + System.out.println("--help -h Print this help text"); + System.out.println("--version -V Print the version number\n"); + System.out.println("--logging -l Enable logging to file"); + System.out.println("--verbose -v Give verbose output"); + System.out.println("--debug -d Print debugging information"); + System.out.println("--analyse -a Print simulation analysis information\n"); + System.out.println("--no-graphics Do not start the GUI (requires --autorun)\n"); + System.out.println("--config Specify a configuration file to use"); + System.out.println("--autorun Autorun the simulation for n updates, then quit"); + System.out.println("--timelapse Set the timelapse between updates\n"); + System.out.println("Copyright (c) 2014-2016 Daniel Vedder"); + System.out.println("Licensed under the terms of the GNU General Public License v3\n"); + } +} diff --git a/src/main/EcologiaIO.java b/src/main/EcologiaIO.java new file mode 100755 index 0000000..552c21b --- /dev/null +++ b/src/main/EcologiaIO.java @@ -0,0 +1,212 @@ +package main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JOptionPane; + +import controller.World; + +/** + * This class provides unified I/O methods for debugging, + * logging, error messages, etc. + * + * @author Daniel Vedder + * @version 3.12.2014 + */ +public abstract class EcologiaIO +{ + public static boolean verbose = false; + public static boolean debugging = false; + public static boolean analysing = false; + public static boolean logging = false; + + public final static int CONTINUABLE_ERROR = 0; + public final static int BREAK_ERROR = 1; + public final static int FATAL_ERROR = 2; + + /** + * Print a log message if the verbose flag is set. + * This is meant to be used for important runtime events in the program, + * and for fundamental (e.g. birth and death) events during the simulation. + * For more detailed output, use either debug() or analysis(). + * + * @param message + */ + public static void log(String message) + { + if (verbose) { + message = "LOG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print a debug message if the debug flag is set. + * This is primarily intended for use during development. + * Experimental data should go to analysis(), important + * messages to log(). + * + * @param message + */ + public static void debug(String message) + { + if (debugging) { + message = "DEBUG: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an analysis message if the analysing flag is set. + * This is meant to be used for simulation data output relevant only to a + * current experiment. + * + * FIXME A lot of analysis() calls slow the program down drastically. + * Implement caching? + * + * @param message + */ + public static void analysis(String message) + { + if (analysing) { + message = "ANALYSIS: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + } + + /** + * Print an error message + * @param message + */ + public static void error(String message) + { + message = "ERROR: "+message; + System.out.println(message); + if (logging) writeFile(message); + } + + /** + * Print an error message and the stack trace + * @param message + * @param error + */ + public static void error(String message, Exception error) + { + message = "ERROR: "+message; + System.out.println(message); + error.printStackTrace(); + //TODO Print stack trace to file + if (logging) writeFile(message); + } + + /** + * Give an error message and pause/shut down + * @param message + * @param errorType CONTINUABLE_ERROR, BREAK_ERROR, FATAL_ERROR + */ + public static void error(String message, int errorType) + { + //FIXME How do we deal with break/fatal errors when in no-graphics mode? + String logMessage = "ERROR: "+message; + if (errorType == BREAK_ERROR) { + World.getInstance().setRunning(false); + logMessage = logMessage+" - simulation paused"; + JOptionPane.showMessageDialog(null, message, "Error!", + JOptionPane.ERROR_MESSAGE); + } + else if (errorType == FATAL_ERROR) { + logMessage = logMessage+" - simulation will terminate"; + JOptionPane.showMessageDialog(null, message+"\nEcologia is shutting down.", + "Error!", JOptionPane.ERROR_MESSAGE); + } + System.out.println(logMessage); + if (logging) writeFile(logMessage); + if (errorType == FATAL_ERROR) System.exit(0); + } + + /** + * Archive the current log file, ready for a new run + */ + public static void archiveLog() + { + File logfile = new File("ecologia.log"); + //Read in the old log and rewrite it to an archive + //XXX: probably an expensive operation on long log files + String log = "\n - archived on "+EcologiaIO.getDate()+"\n"; + try { + BufferedReader logReader = new BufferedReader(new FileReader(logfile)); + String line = logReader.readLine(); + while (line != null) { + log = log+line+"\n"; + line = logReader.readLine(); + } + logReader.close(); + + File logArchive = new File("ecologia-archive.log"); + FileWriter logWriter = new FileWriter(logArchive, true); + logWriter.write(log); + logWriter.flush(); + logWriter.close(); + } + catch (IOException ioe) { /*ignore*/ } + //Then renew the old logfile + try { + FileWriter writer = new FileWriter(logfile, false); + writer.write(" === ECOLOGIA "+Ecologia.version+" LOG ===\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * Print out which flags are set. + */ + public static void printStatus() + { + if (logging) EcologiaIO.debug("Logging ON"); + else EcologiaIO.debug("Logging OFF"); + if (EcologiaIO.verbose) EcologiaIO.debug("Verbose ON"); + else EcologiaIO.debug("Verbose OFF"); + if (EcologiaIO.analysing) EcologiaIO.debug("Analysing ON"); + else EcologiaIO.debug("Analysing OFF"); + if (EcologiaIO.debugging) EcologiaIO.debug("Debugging ON"); + } + + /** + * Write a message to file + */ + private static void writeFile(String message) + { + File logfile = new File("ecologia.log"); + try { + FileWriter writer = new FileWriter(logfile, true); + writer.write(getDate() + message + "\n"); + writer.flush(); + writer.close(); + } + catch (IOException ioe) { + logging = false; + error("Failed to write to logfile! Logging turned off.", ioe); + } + } + + /** + * @return time stamp + */ + private static String getDate() + { + return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss - ").format(new Date()); + } +} diff --git a/src/main/package-info.java b/src/main/package-info.java new file mode 100755 index 0000000..bbf39cc --- /dev/null +++ b/src/main/package-info.java @@ -0,0 +1,8 @@ +/** + * The main package includes the class that contains the main() method, as well as any other classes that + * are needed by all parts of the program, yet are not directly related to the simulation. + * + * @author Daniel Vedder + * + */ +package main; \ No newline at end of file diff --git a/src/model/Animal.java b/src/model/Animal.java new file mode 100755 index 0000000..2917b85 --- /dev/null +++ b/src/model/Animal.java @@ -0,0 +1,471 @@ +package model; + +import java.util.HashMap; +import java.util.Random; +import java.util.ArrayList; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This is the superclass of all animal classes. It holds common methods + * needed by all animals. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public abstract class Animal +{ + /* + * XXX Set ID numbers as long? + * Quick calculation: in a 100x100 world, an integer ID + * (max value: 2**31) should last for >40,000,000 updates + * (based on a 1000 update test run). + * => long IDs are not very urgent... + */ + protected int IDnumber; //A unique identifier for this animal + protected int parent; //The ID number of the parent + protected Genome genome; + protected int generation; + protected int offspring; + protected OccupantType type; + protected int x, y; //The animal's position + protected int age; + protected int energy; + + protected int movesThisTurn; + protected int attemptedMovesThisTurn; + protected int exhaustion; + protected int gestationPeriod; + protected boolean isAlive; + protected Random random; + + /** + * The constructor. + * @param setID + * @param myType + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Animal(int setID, OccupantType myType, Genome newGenome, + int myGeneration, int setX, int setY, int setEnergy, + int parentID) + { + IDnumber = setID; + genome = newGenome; + generation = myGeneration; + offspring = 0; + type = myType; + x = setX; + y = setY; + energy = setEnergy; + parent = parentID; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + exhaustion = 0; + gestationPeriod = genome.getGestation(); + isAlive = true; + random = new Random(); + Simulator.getField(x, y).setOccupant(type); + EcologiaIO.analysis("Created "+type.toString()+" with ID="+IDnumber+ + " parent="+parent+" generation="+generation+ + " update="+World.getInstance().getTurn()); + String genStr = genome.asHashMap().toString(); + EcologiaIO.analysis("Genome of animal "+IDnumber+": "+ + genStr.substring(1, genStr.length()-1)); + } + + /* + * --- Generic methods needed by all animals --- + */ + + /** + * This method has to be called by every species. + */ + public void update() + { + age++; + movesThisTurn = 0; + attemptedMovesThisTurn = 0; + if (exhaustion > 0) exhaustion--; + if (gestationPeriod > 0) gestationPeriod--; + if (age >= genome.getAgeLimit()) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has died!"); + Simulator.removeAnimal(x, y, type); + return; + } + changeEnergy(-1); + if (!isAlive) return; + else if (age >= genome.getMaturityAge() && gestationPeriod == 0 + && energy >= genome.getReproductiveEnergy() + && random.nextInt(3) == 0) { + reproduce(); + } + } + + /** + * The animal reproduces, setting down a child on a neighbouring square + */ + public void reproduce() + { + int r = genome.getReproductionRate(); + for (int i = 0; i < r; i++) { + int[] childField = getNeighbouringField(Direction.randomDirection()); + int ttl = 10; //Make sure we don't end up in an endless loop + while (childField == null || World.getInstance().getFieldInfo(childField[0], childField[1]).get("Occupant") != OccupantType.NONE.toInt()) { + if (ttl == 0) return; //If we still haven't found a space, break off + childField = getNeighbouringField(Direction.randomDirection()); + ttl--; + } + int childEnergy = energy/(r+1); + if (type == OccupantType.HERBIVORE) { + Herbivore child = new Herbivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + else if (type == OccupantType.CARNIVORE) { + Carnivore child = new Carnivore(World.getInstance().getNextID(), + new Genome(genome), generation+1, childField[0], + childField[1], childEnergy, IDnumber); + Simulator.addAnimal(child); + } + offspring++; + } + changeEnergy(-energy/(r+1)); + gestationPeriod = genome.getGestation(); + World.getInstance().incGeneration(generation+1); + World.getInstance().giveNews("A new "+type.toString()+" has been born!"); //XXX Comment this out? + } + + /** + * The animal moves in the specified direction. + * @return success + */ + public boolean move(Direction dir) + { + /* + * Fix the Spring frost bug (very random freezing): + * If there have been more than 12 attempted (and failed) moves this turn, + * e.g. due to the animal being surrounded, we are probably in an endless + * loop and need to break out. + * + * Also fix the Ghost bug: we cannot guarantee that the animal is + * alive at this point, so let's make sure to check. + */ + if (attemptedMovesThisTurn > 12 || !isAlive) { + movesThisTurn++; + return true; + } + + boolean success = true; + int[] nextPos = getNeighbouringField(dir); + //Check if the square to move to is valid + if (nextPos == null || movesThisTurn >= genome.getSpeed() || exhaustion > genome.getStamina() || + OccupantType.fromInt(World.getInstance().getFieldInfo(nextPos[0], nextPos[1]).get("Occupant")) != OccupantType.NONE) { + success = false; + attemptedMovesThisTurn++; + } + + //Execute the move + if (success) { + Simulator.getField(x, y).setOccupant(OccupantType.NONE); + Simulator.getField(nextPos[0], nextPos[1]).setOccupant(type); + x = nextPos[0]; + y = nextPos[1]; + movesThisTurn++; + exhaustion++; + changeEnergy(-1); + } + return success; + } + + /** + * Search for the inputed object within the line of sight. + */ + public int[] search(OccupantType type) + { + //return randomizedSearch(type); + //return closestSearch(type); + return mixedSearch(type); + } + + /** + * Search for the inputed object within the line of sight. + * The returned coordinates are chosen at random from a list of eligible ones. + */ + public int[] randomizedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int[] newTarget = {xdist, ydist}; + targets.add(newTarget); + } + } + } + } + if (targets.size() > 0) return targets.get(random.nextInt(targets.size())); + else return null; + } + + /** + * Search for the inputed object within the line of sight. + * Finds the object closest to the individual. + */ + public int[] closestSearch(OccupantType type) + { + int[] target = {-1, -1}; + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + if (distance != 0 && distance < minDist) { + target[0] = xdist; + target[1] = ydist; + if (distance == 1) break; //Ain't gonna get any better... + } + } + } + } + } + if (target[0] == -1) return null; + else return target; + } + + /** + * Search for the inputed object within the line of sight. + * A random target is chosen out of a list of targets closest to the individual. + */ + public int[] mixedSearch(OccupantType type) + { + ArrayList targets = new ArrayList(); + int minDist = genome.getSight()+1; + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (xdist >= 0 && ydist >= 0 && xdist < World.getInstance().getSize()[0] + && ydist < World.getInstance().getSize()[1]) { + if (Simulator.getField(xdist, ydist).getOccupant() == type) { + int distance = getDistance(xdist, ydist); + int[] newTarget = {xdist, ydist}; + if (distance < minDist) { + targets.clear(); + minDist = distance; + } + if (distance <= minDist) targets.add(newTarget); + } + } + } + } + if (targets.isEmpty()) return null; + else return targets.get(random.nextInt(targets.size())); + } + + /** + * Calculate the neighbouring square in the specified direction + * (return null if out of bounds) + */ + public int[] getNeighbouringField(Direction dir) + { + int nextX = x; + int nextY = y; + switch (dir) { + case UP: nextY--; break; + case RIGHT: nextX++; break; + case DOWN: nextY++; break; + case LEFT: nextX--; break; + case TOP_RIGHT: nextY--; nextX++; break; + case BOTTOM_RIGHT: nextY++; nextX++; break; + case BOTTOM_LEFT: nextY++; nextX--; break; + case TOP_LEFT: nextY--; nextX--; break; + default: EcologiaIO.error("Invalid direction passed to Animal.getNeighbouringField()! ("+dir+") by "+type.toString()+" @"+x+"/"+y); + } + if (nextX < 0 || nextX >= World.getInstance().getSize()[0] || + nextY < 0 || nextY >= World.getInstance().getSize()[1]) { + return null; + } + else { + int[] square = {nextX, nextY}; + return square; + } + } + + /** + * In which direction are the given coordinates relative to this animal? + * @param xpos + * @param ypos + * @return Direction + */ + public Direction getDirection(int xpos, int ypos) + { + if (xpos == x && ypos > y) return Direction.DOWN; + else if (xpos == x && ypos < y) return Direction.UP; + else if (xpos > x && ypos == y) return Direction.RIGHT; + else if (xpos < x && ypos == y) return Direction.LEFT; + else if (xpos > x && ypos > y) return Direction.BOTTOM_RIGHT; + else if (xpos < x && ypos > y) return Direction.BOTTOM_LEFT; + else if (xpos > x && ypos < y) return Direction.TOP_RIGHT; + else if (xpos < x && ypos < y) return Direction.TOP_LEFT; + else return Direction.CENTER; + } + + /** + * How many steps are needed to get to the specified position? + */ + public int getDistance (int xpos, int ypos) + { + int xdist = Math.abs(xpos - x); + int ydist = Math.abs(ypos - y); + return Math.max(xdist, ydist); + } + + /* + * --- Getters --- + */ + + /** + * Return a hash map containing all the information about this animal. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + + //Lifetime variables + info.put("ID", IDnumber); + info.put("Type", type.toInt()); + info.put("X", x); + info.put("Y", y); + info.put("Age", age); + info.put("Energy", energy); + info.put("Generation", generation); + info.put("Parent", parent); + info.put("Offspring", offspring); + + //Genome variables + //XXX This is redundant with Genome.asHashMap() + info.put("Mutation rate", genome.getMutationRate()); + info.put("Speed", genome.getSpeed()); + info.put("Stamina", genome.getStamina()); + info.put("Sight", genome.getSight()); + info.put("Metabolism", genome.getMetabolism()); + info.put("Age limit", genome.getAgeLimit()); + info.put("Strength", genome.getStrength()); + info.put("Reproductive energy", genome.getReproductiveEnergy()); + info.put("Maturity age", genome.getMaturityAge()); + info.put("Gestation", genome.getGestation()); + info.put("Reproduction rate", genome.getReproductionRate()); + + return info; + } + + //XXX Deprecate other getters? [getInfo() available] + + public boolean isAlive() + { + return isAlive; + } + + public long getID() + { + return IDnumber; + } + + public Genome getGenome() + { + return genome; + } + + public int getGeneration() + { + return generation; + } + + public int getParent() + { + return parent; + } + + public int getOffspring() + { + return offspring; + } + + public OccupantType getType() + { + return type; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getAge() + { + return age; + } + + public int getEnergy() + { + return energy; + } + + /* + * A few setters that may be needed + */ + + /** + * Change the energy level of this animal. If it dips to <= 0, the animal + * dies and is removed. This is a convenience wrapper method around + * setEnergy(). + * @param amount + */ + public void changeEnergy(int amount) + { + setEnergy(energy+amount); + } + + public void setEnergy(int newEnergy) + { + energy = newEnergy; + if (energy <= 0) { + isAlive = false; + World.getInstance().giveNews("A "+type.toString()+" has starved!"); + Simulator.removeAnimal(x, y, type); + } + } + + public void setAge(int newAge) + { + age = newAge; + } + + public void setPosition(int newX, int newY) + { + x = newX; + y = newY; + } + + public void exhaust(int e) + { + exhaustion += e; + if (exhaustion < 0) exhaustion = 0; + } +} diff --git a/src/model/Carnivore.java b/src/model/Carnivore.java new file mode 100755 index 0000000..de63be0 --- /dev/null +++ b/src/model/Carnivore.java @@ -0,0 +1,140 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class simulates a carnivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Carnivore extends Animal +{ + public static int fights_won = 1; + public static int total_fights = 1; //Start at 1 to avoid division by zero errors + + private int[] preyPosition; + private Direction currentDirection; + + public static Genome defaultGenome = new Genome(0, 3, 10, 4, 18, 200, 11, 200, 30, 10, 1); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Carnivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.CARNIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + preyPosition = new int[2]; + currentDirection = Direction.randomDirection(); + } + + /** + * Each turn, the carnivore looks for a herbivore and moves towards it. + * If no herbivore can be found, it moves in a random direction. + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + else if (energy > 50 && exhaustion > genome.getStamina() - (2 * genome.getSpeed())) return; //rest + preyPosition = super.search(OccupantType.HERBIVORE); + if (preyPosition != null) hunt(); + else { + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(currentDirection); + if (!moved) currentDirection = Direction.randomDirection(); + } + } + } + + /** + * The carnivore runs toward a herbivore + */ + private void hunt() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is hunting!"); + currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(currentDirection); + if (!success) currentDirection = currentDirection.nextDirection(true); + else if (getDistance(preyPosition[0], preyPosition[1]) == 1 + && movesThisTurn < genome.getSpeed() && isAlive) + attack(); + else currentDirection = super.getDirection(preyPosition[0], preyPosition[1]); + } + } + + /** + * The carnivore has run down a herbivore and now tries to kill it + * XXX Warning: here be magic numbers! + */ + private void attack() + { + EcologiaIO.debug("Carnivore @"+x+"/"+y+" is attacking a prey!"); + Herbivore prey = Simulator.getHerbivore(preyPosition[0], preyPosition[1]);//(x, y); + if (prey == null) { + EcologiaIO.error("Carnivore at "+x+"/"+y+" is attacking a non-existent prey!"); + return; + } + total_fights++; + //Choose a fight algorithm from the methods below - currently strengthFight is used + if (strengthFight(genome.getStrength(), prey.getGenome().getStrength())) { + //Predators get (50+(metabolism*4))% of their preys energy + changeEnergy((int) ((prey.getEnergy()/2)+prey.getEnergy()*(genome.getMetabolism()*0.04))); + World.getInstance().giveNews("A Herbivore has been killed!"); + Simulator.removeAnimal(preyPosition[0], preyPosition[1], OccupantType.HERBIVORE); + /* It would be more efficient to use currentDirection, but I'm not + * sure whether it's guaranteed to be accurate */ + super.move(getDirection(preyPosition[0], preyPosition[1])); + fights_won++; + } + else { + EcologiaIO.debug("A Herbivore has won a fight."); + //Reduce each combatants energy by their strength in the fight + //XXX Change this back again? + changeEnergy(-30); //(-genome.getStrength()); + prey.changeEnergy(-30); //(-prey.getGenome().getStrength()); + exhaust(2); + prey.exhaust(2); + } + movesThisTurn = genome.getSpeed(); //an attack ends the carnivore's turn + } + + //The following methods are various fighting algorithms + //XXX Warning: here be magic numbers! + + /** + * A fight method based on the strength and current energy of the combatants. + * This method is currently not used. + */ + private boolean strengthEnergyFight(int pred_str, int pred_en, int prey_str, int prey_en) + { + int predStrength = pred_str+(pred_en/50); + int preyStrength = prey_str+(prey_en/50)+super.random.nextInt(10); + return (predStrength > preyStrength); + } + + /** + * A fight method based on the strength of the combatants. + * This is the method currently employed. + */ + private boolean strengthFight(int predStrength, int preyStrength) + { + int randomFactor = super.random.nextInt(10)-3; + preyStrength += randomFactor; + return (predStrength > preyStrength); + } + + +} diff --git a/src/model/Direction.java b/src/model/Direction.java new file mode 100755 index 0000000..ebac35f --- /dev/null +++ b/src/model/Direction.java @@ -0,0 +1,114 @@ +package model; + +import java.util.Random; + + +/** + * A list of directions and common methods related to them + * is often needed by animals. + * + * @author Daniel Vedder + * @version 26.12.2014 + */ +public enum Direction +{ + UP, DOWN, LEFT, RIGHT, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER; + + /** + * Return the opposite direction + */ + public Direction oppositeDirection() + { + switch (this) { + case UP: return DOWN; + case DOWN: return UP; + case RIGHT: return LEFT; + case LEFT: return RIGHT; + case TOP_LEFT: return BOTTOM_RIGHT; + case BOTTOM_LEFT: return TOP_RIGHT; + case TOP_RIGHT: return BOTTOM_LEFT; + case BOTTOM_RIGHT: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return the next direction, going clockwise (if cw = true) + * or anticlockwise (if cw = false) + * @param clockwise + */ + public Direction nextDirection(boolean clockwise) + { + if (clockwise) { + switch (this) { + case UP: return TOP_RIGHT; + case TOP_RIGHT: return RIGHT; + case RIGHT: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return DOWN; + case DOWN: return BOTTOM_LEFT; + case BOTTOM_LEFT: return LEFT; + case LEFT: return TOP_LEFT; + case TOP_LEFT: return UP; + default: return CENTER; + } + } + else { + switch (this) { + case UP: return TOP_LEFT; + case TOP_LEFT: return LEFT; + case LEFT: return BOTTOM_LEFT; + case BOTTOM_LEFT: return DOWN; + case DOWN: return BOTTOM_RIGHT; + case BOTTOM_RIGHT: return RIGHT; + case RIGHT: return TOP_RIGHT; + case TOP_RIGHT: return UP; + default: return CENTER; + } + } + } + + /** + * Return a random direction + */ + public static Direction randomDirection() + { + Random r = new Random(); + return fromInt(r.nextInt(8)); + } + + /** + * Return the direction that this number refers to. + */ + public static Direction fromInt(int d) + { + switch (d) { + case 0: return UP; + case 1: return TOP_RIGHT; + case 2: return RIGHT; + case 3: return BOTTOM_RIGHT; + case 4: return DOWN; + case 5: return BOTTOM_LEFT; + case 6: return LEFT; + case 7: return TOP_LEFT; + default: return CENTER; + } + } + + /** + * Return a string representation of this direction. + */ + public String getString() + { + switch (this) { + case UP: return "up"; + case DOWN: return "down"; + case RIGHT: return "right"; + case LEFT: return "left"; + case TOP_LEFT: return "top left"; + case BOTTOM_LEFT: return "bottom left"; + case TOP_RIGHT: return "top right"; + case BOTTOM_RIGHT: return "bottom right"; + default: return "center"; + } + } +} diff --git a/src/model/Genome.java b/src/model/Genome.java new file mode 100755 index 0000000..477d48b --- /dev/null +++ b/src/model/Genome.java @@ -0,0 +1,239 @@ +package model; + +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.OccupantType; + +/** + * A genome holds a number of variables ("genes") that determine an animals characteristics. + * Note: this class has three constructors! + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Genome +{ + private int mutationRate; //The probability of a mutation occurring in percent. + private int speed; //How fast is the animal (fields/update)? + //XXX Remove stamina again? + private int stamina; //For how long can this animal keep moving before it needs a rest? + private int sight; //How far can the animal see (fields distant)? + private int metabolism; //How efficient is it's metabolism? + private int ageLimit; //The age at which it will die of old age + private int strength; //How strong is it in a fight + private int reproductiveEnergy; //How much energy it needs before it will reproduce - 50% will be transferred to the child + private int maturityAge; //The age at which it reaches sexual maturity + private int gestation; //The minimum time needed for the reproductive cycle + private int reproductionRate; //How many offspring are produced at once? + + private final int DEFAULT_MUTATION_RATE = 0; //Suggested default: 0 + + private static Genome herbivoreGenome, carnivoreGenome; + + private Random random; + + /** + * The default constructor provides a standard genome. + */ + public Genome() + { + mutationRate = 5; + speed = 1; + stamina = 10; + sight = 3; + metabolism = 10; + ageLimit = 180; + strength = 10; + reproductiveEnergy = 140; + maturityAge = 20; + gestation = 10; + reproductionRate = 1; + } + + /** + * This constructor creates a new genome based on the parent genome passed + * to it, mutating it at random. + */ + public Genome(Genome parentGenome) + { + random = new Random(); + /* Before we can mutate the mutation rate, we need to know a + * preliminary mutation rate or we get a NullPointerException + */ + mutationRate = DEFAULT_MUTATION_RATE; + // Mutate the parent's genes to get this genome + // XXX Warning: magic numbers! + mutationRate = parentGenome.getMutationRate()+mutation(1); + speed = parentGenome.getSpeed()+mutation(1); + stamina = parentGenome.getStamina()+mutation(1); + sight = parentGenome.getSight()+mutation(1); + metabolism = parentGenome.getMetabolism()+mutation(1); + ageLimit = parentGenome.getAgeLimit()+mutation(10); + strength = parentGenome.getStrength()+mutation(1); + reproductiveEnergy = parentGenome.getReproductiveEnergy()+mutation(10); + maturityAge = parentGenome.getMaturityAge()+mutation(1); + gestation = parentGenome.getGestation()+mutation(1); + reproductionRate = parentGenome.getReproductionRate()+mutation(1); + checkGenome(); + } + + /** + * This constructor creates a genome from the values passed to it. + */ + public Genome(int mutationRate, int speed, int stamina, int sight, int metabolism, + int ageLimit, int strength, int reproductiveEnergy, int maturityAge, + int gestation, int reproductionRate) + { + this.mutationRate = mutationRate; + this.speed = speed; + this.stamina = stamina; + this.sight = sight; + this.metabolism = metabolism; + this.ageLimit = ageLimit; + this.strength = strength; + this.reproductiveEnergy = reproductiveEnergy; + this.maturityAge = maturityAge; + this.gestation = gestation; + this.reproductionRate = reproductionRate; + checkGenome(); + } + + /** + * This constructor creates a genome from a HashMap. + */ + public Genome(HashMap genVars) + { + this.mutationRate = genVars.get("mutationRate"); + this.speed = genVars.get("speed"); + this.stamina = genVars.get("stamina"); + this.sight = genVars.get("sight"); + this.metabolism = genVars.get("metabolism"); + this.ageLimit = genVars.get("ageLimit"); + this.strength = genVars.get("strength"); + this.reproductiveEnergy = genVars.get("reproductiveEnergy"); + this.maturityAge = genVars.get("maturityAge"); + this.gestation = genVars.get("gestation"); + this.reproductionRate = genVars.get("reproductionRate"); + checkGenome(); + } + + /** + * Returns a mutation factor depending on the specified mutation rate. + * @param coefficient Influences the size of the returned factor. + * @return factor The wanted mutation factor. + */ + private int mutation(int coefficient) + { + int factor = 0; + if (random.nextInt(100) < mutationRate) { //Does a mutation take place? + if (random.nextInt(2) == 0) { //If yes there is a 50% chance of... + factor = factor+coefficient; //...adding the coefficient to the factor + } + else { + factor = factor-coefficient; //...subtracting the coefficient from the factor + } + } + return factor; //return the (perhaps) mutated factor + } + + /** + * Check to make sure that no "gene" has a value below zero + */ + private void checkGenome() + { + if (mutationRate < 0) mutationRate = 0; + if (speed < 0) speed = 0; + if (sight < 0) sight = 0; + if (metabolism < 0) metabolism = 0; + if (ageLimit < 0) ageLimit = 0; + if (strength < 0) strength = 0; + if (reproductiveEnergy < 0) reproductiveEnergy = 0; + if (maturityAge < 0) maturityAge = 0; + if (gestation < 0) gestation = 0; + if (reproductionRate < 0) reproductionRate = 0; + } + + /** + * Return all the "genes" of this genome in a single HashMap. + * @return genomeInfo + */ + public HashMap asHashMap() + { + HashMap genomeInfo = new HashMap(); + genomeInfo.put("mutationRate", mutationRate); + genomeInfo.put("speed", speed); + genomeInfo.put("stamina", stamina); + genomeInfo.put("sight", sight); + genomeInfo.put("metabolism", metabolism); + genomeInfo.put("ageLimit", ageLimit); + genomeInfo.put("strength", strength); + genomeInfo.put("reproductiveEnergy", reproductiveEnergy); + genomeInfo.put("maturityAge", maturityAge); + genomeInfo.put("gestation", gestation); + genomeInfo.put("reproductionRate", reproductionRate); + return genomeInfo; + } + + /* + * The Getters for each "gene" + * XXX Are these invalidated with asHashMap()? + */ + + public int getMutationRate() + { + return mutationRate; + } + + public int getSpeed() + { + return speed; + } + + public int getStamina() + { + return stamina; + } + + public int getSight() + { + return sight; + } + + public int getMetabolism() + { + return metabolism; + } + + public int getAgeLimit() + { + return ageLimit; + } + + public int getStrength() + { + return strength; + } + + public int getReproductiveEnergy() + { + return reproductiveEnergy; + } + + public int getMaturityAge() + { + return maturityAge; + } + + public int getGestation() + { + return gestation; + } + + public int getReproductionRate() + { + return reproductionRate; + } + +} diff --git a/src/model/Herbivore.java b/src/model/Herbivore.java new file mode 100755 index 0000000..ee40b4e --- /dev/null +++ b/src/model/Herbivore.java @@ -0,0 +1,124 @@ +package model; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +import java.util.ArrayList; + +/** + * This class simulates a herbivore. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Herbivore extends Animal +{ + private int[] predatorPosition; + + public static Genome defaultGenome = new Genome(0, 2, 10, 4, 10, 150, 10, 120, 15, 10, 2); + + /** + * The constructor. + * @param setID + * @param newGenome + * @param myGeneration + * @param setX + * @param setY + * @param setEnergy + * @param parentID + */ + public Herbivore(int setID, Genome newGenome, int myGeneration, int setX, + int setY, int setEnergy, int parentID) + { + super(setID, OccupantType.HERBIVORE, newGenome, myGeneration, setX, + setY, setEnergy, parentID); + predatorPosition = new int[2]; + } + + /** + * Each turn, the herbivore looks out for predators and flees if it finds any, + * or otherwise grazes, if need be moving to better feeding grounds + */ + public void update() + { + super.update(); + if (!isAlive) return; //Don't do anything more if the animal is dead + predatorPosition = search(OccupantType.CARNIVORE); + if (predatorPosition != null) flee(); + else if (Simulator.getField(x, y).getGrassDensity() < 20 + && exhaustion < genome.getStamina() - genome.getSpeed()) { + moveToNewGrazingGrounds(); + feed(); + } + else feed(); + + } + + /** + * Graze the current tile. + * XXX: here be magic numbers! + */ + private void feed() + { + if (movesThisTurn < genome.getSpeed() && exhaustion < genome.getStamina() + && Simulator.getField(x, y).getGrassDensity() > 0) { + movesThisTurn++; + int feedEnergy = genome.getMetabolism()/3; + changeEnergy(feedEnergy); + Simulator.getField(x, y).reduceGrassDensity(feedEnergy*2); + } + } + + /** + * Search the surrounding squares for one with a higher grass density and move there + */ + private void moveToNewGrazingGrounds() + { + int currentGrassDensity = Simulator.getField(x, y).getGrassDensity(); + Direction dir = Direction.randomDirection(); + ArrayList possibleDirs = new ArrayList(); + // Search within range of sight + for (int xdist = x-genome.getSight(); xdist < x+genome.getSight(); xdist++) { + for (int ydist = y-genome.getSight(); ydist < y+genome.getSight(); ydist++) { + if (!(xdist == x && ydist == y) && xdist >= 0 && ydist >= 0 && + xdist < World.getInstance().getSize()[0] && ydist < World.getInstance().getSize()[1] && + Simulator.getField(xdist, ydist).getGrassDensity() > currentGrassDensity) { + Direction d = super.getDirection(xdist, ydist); + if (!possibleDirs.contains(d)) possibleDirs.add(d); + } + } + } + // Try to move into one of the possible directions + int ttl = 12; + while (ttl > 0) { + if (possibleDirs.isEmpty()) break; + dir = possibleDirs.get(super.random.nextInt(possibleDirs.size())); + if (super.move(dir)) return; + possibleDirs.remove(dir); + ttl--; + } + // If nothing is found, move randomly + while (movesThisTurn < genome.getSpeed()) { + boolean moved = super.move(dir); + if (!moved) dir = Direction.randomDirection(); + } + } + + /** + * Run away from a predator + */ + private void flee() + { + Direction predDir = super.getDirection(predatorPosition[0], predatorPosition[1]); + if (predDir == Direction.CENTER) //Should never happen + EcologiaIO.error("Herbivore @ "+x+"/"+y+" is fleeing in direction CENTER from carnivore @"+predatorPosition[0]+"/"+predatorPosition[1]+"!", + EcologiaIO.BREAK_ERROR); + Direction flightDir = predDir.oppositeDirection(); + while (movesThisTurn < genome.getSpeed()) { + boolean success = super.move(flightDir); + if (!success) flightDir = Direction.randomDirection(); + } + } + +} diff --git a/src/model/MapField.java b/src/model/MapField.java new file mode 100755 index 0000000..59e1f89 --- /dev/null +++ b/src/model/MapField.java @@ -0,0 +1,104 @@ +package model; + +import java.util.HashMap; + +import controller.Humidity; +import controller.OccupantType; + +/** + * This is a representation of a discrete area (tile) on the map. It monitors + * what animals are on it, what it's grass density is, etc. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class MapField +{ + private int x, y; + private int grassDensity; + private boolean isNearWater; + private Humidity localHumidity; + private OccupantType occupant; + + /** + * The constructor. + */ + public MapField(int xstart, int ystart, OccupantType newOccupant, + Humidity startingHumidity, int startingGrassDensity) + { + x = xstart; + y = ystart; + occupant = newOccupant; + localHumidity = startingHumidity; + grassDensity = startingGrassDensity; + isNearWater = false; + } + + /** + * Recalculate the grass density based on humidity values. + * Min: 0 Max: 100 + */ + public void calculateGrassDensity() + { + grassDensity = grassDensity + 2*localHumidity.getValue(); + if (grassDensity >= 100) grassDensity = 100; + else if (grassDensity <= 0) grassDensity = 0; + //If this is a water tile, the grass density is always 100 + if (occupant == OccupantType.WATER) grassDensity = 100; + } + + /* + * Getters and setters + */ + + /** + * Return a hash map containing all the information about this field. + */ + public HashMap getInfo() + { + HashMap info = new HashMap(); + info.put("X", x); + info.put("Y", y); + info.put("Grass density", grassDensity); + info.put("Local humidity", localHumidity.getValue()); + info.put("Occupant", occupant.toInt()); + return info; + } + + public void setNearWater(boolean newValue) + { + isNearWater = newValue; + } + + public boolean nearWater() + { + return isNearWater; + } + + public int getGrassDensity() { + return grassDensity; + } + + public OccupantType getOccupant() { + return occupant; + } + + public void setOccupant(OccupantType occupant) { + this.occupant = occupant; + } + + public Humidity getLocalHumidity() { + return localHumidity; + } + + public void setLocalHumidity(Humidity localHumidity) { + this.localHumidity = localHumidity; + } + + public void reduceGrassDensity(int amount) + { + grassDensity -= amount; + if (grassDensity < 0) grassDensity = 0; + } + +} diff --git a/src/model/Simulator.java b/src/model/Simulator.java new file mode 100755 index 0000000..a2d9477 --- /dev/null +++ b/src/model/Simulator.java @@ -0,0 +1,284 @@ +package model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * The Simulator class is the main class of the model package. It manages all + * elements of the actual simulation, and passes any relevant information on + * to World. + * + * @author Daniel Vedder + * @version 30.8.2014 + */ +public class Simulator +{ + private static ArrayList herbivorePopulation; + private static ArrayList carnivorePopulation; + private static MapField[][] map; + private Random random; + + /** + * The constructor. + */ + public Simulator() + { + EcologiaIO.debug("Creating simulator"); + random = new Random(); + initMap(); + initWaterTiles(); + initPopulations(); + updateWorld(); + } + + /** + * Updates the model each turn. + */ + public void update() + { + //Calculate the new grass density on each plot + EcologiaIO.debug("Simulator: Recalculating grass density."); + double averageDensity = 0; + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + if (!map[x][y].nearWater()) { + map[x][y].setLocalHumidity(World.getInstance().getHumidity()); + } + map[x][y].calculateGrassDensity(); + averageDensity += map[x][y].getGrassDensity(); + } + } + averageDensity = averageDensity/(xsize*ysize); + World.getInstance().setAverageGrassDensity((int) averageDensity); + + //Each animal has its turn + EcologiaIO.debug("Simulator: Updating herbivores."); + for (int h = 0; h < herbivorePopulation.size(); h++) { + herbivorePopulation.get(h).update(); + } + EcologiaIO.debug("Simulator: Updating carnivores."); + for (int c = 0; c < carnivorePopulation.size(); c++) { // <-- C++ in a Java program :D + carnivorePopulation.get(c).update(); + } + double hunt_success = (double) Carnivore.fights_won / (double) Carnivore.total_fights; + EcologiaIO.analysis("Carnivore hunt success rate: "+(int) (hunt_success*100)+"%"); + + updateWorld(); + } + + /** + * Send the current state of the simulation on to World + */ + public void updateWorld() + { + EcologiaIO.debug("Simulator: Collecting information to send to World."); + //The states of all animals are collected and passed on to the World + ArrayList> animalInfo = new ArrayList>(); + for (int hi = 0; hi < herbivorePopulation.size(); hi++) { + animalInfo.add(herbivorePopulation.get(hi).getInfo()); + } + for (int ci = 0; ci < carnivorePopulation.size(); ci++) { + animalInfo.add(carnivorePopulation.get(ci).getInfo()); + } + World.getInstance().setAnimals(animalInfo); + + //Update the population counters + World.getInstance().setCarnivoreCount(carnivorePopulation.size()); + World.getInstance().setHerbivoreCount(herbivorePopulation.size()); + } + + /* + * Component initialisation + */ + + /** + * Initialise the map. + */ + private void initMap() + { + EcologiaIO.debug("Simulator: initialising map."); + int xsize = World.getInstance().getSize()[0]; + int ysize = World.getInstance().getSize()[1]; + map = new MapField[xsize][ysize]; + for (int x = 0; x < xsize; x++) { + for (int y = 0; y < ysize; y++) { + map[x][y] = new MapField(x, y, OccupantType.NONE, + World.getInstance().getHumidity(), + World.getInstance().getStartGrassDensity()); + } + } + } + + /** + * Initialise the water tiles. + */ + private void initWaterTiles() + { + EcologiaIO.debug("Simulator: initialising water tiles."); + for (int i = 0; i < World.getInstance().getWaterTiles(); i++) { + //Each water tile is placed in a random location + int setX = random.nextInt(World.getInstance().getSize()[0]); + int setY = random.nextInt(World.getInstance().getSize()[1]); + while (map[setX][setY].getOccupant() != OccupantType.NONE) { + setX = random.nextInt(World.getInstance().getSize()[0]); + setY = random.nextInt(World.getInstance().getSize()[1]); + } + map[setX][setY].setOccupant(OccupantType.WATER); + //The fields around each water tile are watered + for (int x = setX-2; x <= setX+2; x++) { + for (int y = setY-2; y <= setY+2; y++) { + try { + Simulator.getField(x, y).setNearWater(true); + Simulator.getField(x, y).setLocalHumidity(Humidity.SATURATION); + } + catch (ArrayIndexOutOfBoundsException aioobe) {} //Can be safely ignored + } + } + } + } + + /** + * Initialise the animal populations. + */ + private void initPopulations() + { + carnivorePopulation = new ArrayList(); + herbivorePopulation = new ArrayList(); + //Create the initial carnivore population, setting each carnivore down at a random position + EcologiaIO.debug("Simulator: initialising carnivores."); + for (int j = 0; j < World.getInstance().getStartNoCarnivores(); j++) { + int setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + int setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXCarnivore][setYCarnivore].getOccupant() != OccupantType.NONE) { + setXCarnivore = random.nextInt(World.getInstance().getSize()[0]); + setYCarnivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyCarnivores = World.getInstance().getStartEnergyCarnivores(); + carnivorePopulation.add(new Carnivore(World.getInstance().getNextID(), + Carnivore.defaultGenome, 1, setXCarnivore, setYCarnivore, + startEnergyCarnivores, 0)); + } + //Create the initial herbivore population, setting each herbivore down at a random position + EcologiaIO.debug("Simulator: initialising herbivores."); + for (int i = 0; i < World.getInstance().getStartNoHerbivores(); i++) { + int setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + int setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + while (map[setXHerbivore][setYHerbivore].getOccupant() != OccupantType.NONE) { + setXHerbivore = random.nextInt(World.getInstance().getSize()[0]); + setYHerbivore = random.nextInt(World.getInstance().getSize()[1]); + } + int startEnergyHerbivores = World.getInstance().getStartEnergyHerbivores(); + herbivorePopulation.add(new Herbivore(World.getInstance().getNextID(), + Herbivore.defaultGenome, 1, setXHerbivore, setYHerbivore, + startEnergyHerbivores, 0)); + } + } + + /* + * Interface methods for interacting with map and animals + */ + + /** + * Returns the field at the required position. + * @param x, y + * @return MapField + */ + + public static MapField getField(int x, int y) + { + return map[x][y]; + } + + /** + * Return the animal at (x, y), or null if there is no animal at that field. + */ + public static Animal getAnimal(int x, int y) + { + Animal a = getHerbivore(x, y); + if (a == null) a = getCarnivore(x, y); + return a; + } + + /** + * Return the herbivore at (x, y), or null if there is no animal at that field. + */ + public static Herbivore getHerbivore(int x, int y) + { + for (int h = 0; h < herbivorePopulation.size(); h++) { + if (herbivorePopulation.get(h).getX() == x && herbivorePopulation.get(h).getY() == y) { + return herbivorePopulation.get(h); + } + } + return null; + } + + /** + * Return the carnivore at (x, y), or null if there is no animal at that field. + */ + public static Carnivore getCarnivore(int x, int y) + { + for (int c = 0; c < carnivorePopulation.size(); c++) { + if (carnivorePopulation.get(c).getX() == x && carnivorePopulation.get(c).getY() == y) { + return carnivorePopulation.get(c); + } + } + return null; + } + + /** + * Add an animal to the population + * @param animal + */ + public static void addAnimal(Animal a) + { + EcologiaIO.debug("Simulator: adding a "+a.getType().toString()); + if (a.getType() == OccupantType.HERBIVORE) { + herbivorePopulation.add((Herbivore) a); + } + else if (a.getType() == OccupantType.CARNIVORE) { + carnivorePopulation.add((Carnivore) a); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to addAnimal()!", + EcologiaIO.FATAL_ERROR); + } + } + + /** + * Remove an animal from the population + * @param x, y coordinates + * @param type Make sure we are removing the right animal + */ + public static void removeAnimal(int x, int y, OccupantType type) + { + Animal a = null; + if (type == OccupantType.CARNIVORE) a = getCarnivore(x, y); + else if (type == OccupantType.HERBIVORE) a = getHerbivore(x, y); + if (a == null) { + EcologiaIO.error("Simulator.removeAnimal(): no "+type.toString()+" at "+x+"/"+y+"."); + } + else if (type == OccupantType.HERBIVORE) { + herbivorePopulation.remove((Herbivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a herbivore."); + } + else if (type == OccupantType.CARNIVORE) { + carnivorePopulation.remove((Carnivore) a); + map[x][y].setOccupant(OccupantType.NONE); + EcologiaIO.debug("Simulator: removing a carnivore."); + } + else { + EcologiaIO.error("Simulator: Invalid OccupantType passed to removeAnimal()!", + EcologiaIO.FATAL_ERROR); + } + if (a != null) EcologiaIO.analysis("Animal "+a.getID()+" died at age "+a.getAge()); + } +} diff --git a/src/model/package-info.java b/src/model/package-info.java new file mode 100755 index 0000000..cb543e5 --- /dev/null +++ b/src/model/package-info.java @@ -0,0 +1,7 @@ +/** + * model is responsible for the program logic. This is where the actual simulation takes place. + * + * @author Daniel Vedder + * + */ +package model; \ No newline at end of file diff --git a/src/view/Display.java b/src/view/Display.java new file mode 100755 index 0000000..29f5e73 --- /dev/null +++ b/src/view/Display.java @@ -0,0 +1,166 @@ +package view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JPanel; +import javax.swing.Scrollable; + +import main.EcologiaIO; +import controller.OccupantType; +import controller.World; + +/** + * This class provides a graphical representation of the simulation. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class Display extends JPanel implements Scrollable, MouseListener +{ + private int[] size; + private InfoBox infobox; + + /** + * The constructor + * @param int[2] size + */ + public Display(int[] setSize) + { + EcologiaIO.debug("Display: initialising."); + size = setSize; + this.setSize(size[0]*20, size[1]*20); + this.setPreferredSize(new Dimension(size[0]*20, size[1]*20)); + this.setBackground(Color.GRAY); + infobox = new InfoBox(); + this.addMouseListener(this); + } + + /** + * Update the display + */ + public void update() + { + repaint(); + infobox.refresh(); + } + + /** + * Draw the current status of the simulation onto the panel. + */ + public void paintComponent(Graphics g) + { + for (int x = 0; x < size[0]; x++) { + for (int y = 0; y < size[1]; y++) { + //the grass density on it affects the colour of the tile + if (World.getInstance().getFieldInfo(x, y).get("Grass density") > 20) { + g.setColor(Color.green); + } + else if ((World.getInstance().getFieldInfo(x, y).get("Grass density") <= 20) + && (World.getInstance().getFieldInfo(x, y).get("Grass density") > 0)) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.white); + } + g.fillRect(x*20, y*20, 20, 20);//colour the tiles + g.setColor(Color.black); + g.drawRect(x*20, y*20, 20, 20);//draw the tiles as squares + //draw in any animal occupants of the tile, or a water tile + if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.CARNIVORE) { + g.setColor(Color.red); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.HERBIVORE) { + g.setColor(Color.gray); + g.fillOval(x*20+4, y*20+4, 12, 12); + } + else if (OccupantType.fromInt(World.getInstance().getFieldInfo(x, y).get("Occupant")) + == OccupantType.WATER) { + g.setColor(Color.blue); + g.fillRect(x*20+2, y*20+2, 16, 16); + } + } + } + } + + /** + * Return the current infobox instance + */ + public InfoBox getInfoBox() + { + return infobox; + } + + //Override methods from the Scrollable and MouseListener interfaces + + @Override + public void mouseClicked(MouseEvent click) { + int fieldX = click.getX()/20; + int fieldY = click.getY()/20; + if (fieldX >= 0 && fieldX < World.getInstance().getSize()[0] && fieldY >= 0 + && fieldY < World.getInstance().getSize()[1]) { + infobox.show(click.getX()/20, click.getY()/20); + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // Auto-generated method stub + + } + + @Override + public Dimension getPreferredScrollableViewportSize() { + // Auto-generated method stub + return null; + } + + @Override + public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } + + @Override + public boolean getScrollableTracksViewportHeight() { + // Auto-generated method stub + return false; + } + + @Override + public boolean getScrollableTracksViewportWidth() { + // Auto-generated method stub + return false; + } + + @Override + public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) { + // Auto-generated method stub + return 0; + } +} diff --git a/src/view/GUI.java b/src/view/GUI.java new file mode 100755 index 0000000..9712106 --- /dev/null +++ b/src/view/GUI.java @@ -0,0 +1,363 @@ +package view; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import javax.swing.*; + +import controller.Humidity; +import controller.World; +import main.*; + +/** + * This class is the main class of the view package. It combines all the different + * GUI components required for the programme. + * + * @author Daniel Vedder + * @version 29.8.2014 + */ +public class GUI extends JFrame +{ + private static final long serialVersionUID = 4727895060816956404L; + private Box information; + private JMenuBar menubar; + private JMenu file, configuration, help_menu; + private JMenuItem new_run, exit, programConfigBox, simConfigBox, genomeConfigBox, configFileDialog, help, about; + private JLabel update_counter, herbivore_counter, carnivore_counter, generation_counter, grass_counter; + private JComboBox humidityChooser; + private JTextArea ticker; //XXX Remove this at some point? + private JTextField stopAtField; + private JCheckBox disableDisplay; + private JScrollPane scrollticker, scrollscreen; + private JButton run, next; + private JSlider speedSlider; + private Display display; + private ProgramConfig programConfig; + private SimulationConfig simulationConfig; + private GenomeConfig genomeConfig; + private JFileChooser configChooser; + private HelpWindow helpWindow; + + /** + * The constructor. + */ + public GUI() + { + EcologiaIO.debug("Creating GUI"); + this.setTitle("Ecologia"); + this.setSize(1000, 560); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + createMenu(); + addInformationPanel(); + addDisplay(); + programConfig = new ProgramConfig(); + simulationConfig = new SimulationConfig(); + genomeConfig = new GenomeConfig(); + configChooser = new JFileChooser(System.getProperty("user.dir")); + helpWindow = new HelpWindow(); + this.setVisible(true); + } + + /** + * Update the GUI. + */ + public synchronized void update() + { + EcologiaIO.debug("GUI: updating display."); + //Update the display + if (!disableDisplay.isSelected()) { + display.update(); + } + displayNews(); + //Make sure the "run" button is displaying the right text + if (World.getInstance().isRunning()) run.setText("Stop"); + else run.setText("Start"); + //Update the humidity from the combo box + Humidity setHumidity = Humidity.fromString((String) humidityChooser.getSelectedItem()); + if (setHumidity != World.getInstance().getHumidity()) { + World.getInstance().setHumidity(setHumidity); + EcologiaIO.log("Humidity set to "+setHumidity.getString()); + } + //Update the simulation speed from the speed slider + int setSpeed = speedSlider.getMaximum() - speedSlider.getValue(); + World.getInstance().setTimelapse(setSpeed); + //Update the stopAt variable from user input + try { + World.getInstance().setStopAt(Integer.parseInt((stopAtField.getText()))); + } + catch (NumberFormatException nfe) {} + //Update the various counters + update_counter.setText("Updates: "+ World.getInstance().getTurn()); + herbivore_counter.setText("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter.setText("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter.setText("Generations: "+World.getInstance().getGeneration()); + grass_counter.setText("Grass density: "+World.getInstance().getAverageGrassDensity()); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + } + + /** + * Add the menubar + */ + private void createMenu() + { + EcologiaIO.debug("GUI: creating menubar."); + menubar = new JMenuBar(); + file = new JMenu("File"); + configuration = new JMenu("Configuration"); + help_menu = new JMenu("Help"); + new_run = new JMenuItem("New Run"); + exit = new JMenuItem("Exit"); + programConfigBox = new JMenuItem("Ecologia"); + simConfigBox = new JMenuItem("Simulation"); + genomeConfigBox = new JMenuItem("Genomes"); + configFileDialog = new JMenuItem("Configuration file"); + help = new JMenuItem("Help"); + about = new JMenuItem("About"); + menubar.add(file); + menubar.add(configuration); + menubar.add(help_menu); + file.add(new_run); + file.add(exit); + new_run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int restart = JOptionPane.showConfirmDialog(null, "Restart now?", "Restart?", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (restart == JOptionPane.OK_OPTION) Ecologia.getInstance().reset(); + } + }); + new_run.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); + exit.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int confirm = JOptionPane.showConfirmDialog(null, "Quit Ecologia?", "Quit?", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + if(confirm == JOptionPane.YES_OPTION){ + EcologiaIO.log("Stopping Ecologia."); + System.exit(0); + } + } + }); + exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); + configuration.add(programConfigBox); + configuration.add(simConfigBox); + configuration.add(genomeConfigBox); + configuration.add(configFileDialog); + programConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + programConfig.showConfig(); + } + }); + simConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + simulationConfig.showConfig(true); + } + }); + genomeConfigBox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + genomeConfig.showGenomeConfig(true); + } + }); + configFileDialog.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + int returnVal = configChooser.showDialog(null, "Load config file"); + if (returnVal == JFileChooser.APPROVE_OPTION) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: Loading a config file requires a restart.\nRestart now?", + "Restart?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart == JOptionPane.YES_OPTION) { + World.getInstance().readConfigFile(configChooser. + getSelectedFile().getAbsolutePath()); + Ecologia.getInstance().reset(); + } + } + } + }); + help_menu.add(help); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + helpWindow.setVisible(true); + } + }); + help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); + help_menu.add(about); + about.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + JOptionPane.showMessageDialog(null, "Ecologia "+Ecologia.version+ + "\n(c) 2014 - 2016 Daniel Vedder\nLicensed under the GPLv3", + "About", JOptionPane.INFORMATION_MESSAGE); + } + }); + this.setJMenuBar(menubar); + } + + /** + * Add the information panel at the side + */ + private void addInformationPanel() + { + EcologiaIO.debug("GUI: creating information panel."); + //Configure the main information panel + information = new Box(BoxLayout.Y_AXIS); + this.add(information, BorderLayout.EAST); + information.setBackground(Color.lightGray); + //Add the counters at the top + update_counter = new JLabel("Updates: "+ World.getInstance().getTurn()); + herbivore_counter = new JLabel("Herbivores: "+ World.getInstance().getHerbivoreCount()); + carnivore_counter = new JLabel("Carnivores: "+ World.getInstance().getCarnivoreCount()); + generation_counter = new JLabel("Generations: "+World.getInstance().getGeneration()); + grass_counter = new JLabel("Grass density: "+World.getInstance().getAverageGrassDensity()); + information.add(update_counter); + information.add(Box.createVerticalStrut(3)); + information.add(herbivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(carnivore_counter); + information.add(Box.createVerticalStrut(3)); + information.add(generation_counter); + information.add(Box.createVerticalStrut(3)); + information.add(grass_counter); + information.add(Box.createVerticalStrut(3)); + //Add the event ticker + ticker = new JTextArea(); + ticker.setEditable(false); + ticker.setLineWrap(true); + ticker.setWrapStyleWord(true); + ticker.setText(" --- Runtime Protocol ---"); + scrollticker = new JScrollPane(ticker); + scrollticker.setWheelScrollingEnabled(true); + information.add(scrollticker); + information.add(Box.createVerticalStrut(10)); + //Add the humidity chooser + Box hum_panel = new Box(BoxLayout.X_AXIS); + JLabel humidity = new JLabel("Humidity: "); + humidityChooser = new JComboBox(new String[] + {Humidity.SATURATION.getString(), Humidity.WET.getString(), Humidity.DRY.getString(), + Humidity.DROUGHT.getString(), Humidity.SEVERE_DROUGHT.getString()}); + humidityChooser.setMaximumSize(new Dimension(140, 30)); + humidityChooser.setSelectedItem(World.getInstance().getHumidity().getString()); + hum_panel.add(humidity); + hum_panel.add(humidityChooser); + information.add(hum_panel); + information.add(Box.createVerticalStrut(10)); + //Add the "Start/Stop" and "Next" buttons + Box buttonPanel = new Box(BoxLayout.X_AXIS); + run = new JButton("Start"); + //This button starts or pauses the simulation. + run.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (World.getInstance().isRunning() == false) { + Ecologia.getInstance().startThread(); + } + else { + run.setText("Start"); + World.getInstance().setRunning(false); + } + } + }); + next = new JButton("Next "); + //This button advances the simulation by one update. + next.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Ecologia.getInstance().iterate(); + } + }); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(run); + buttonPanel.add(Box.createVerticalStrut(1)); + buttonPanel.add(next); + buttonPanel.add(Box.createVerticalStrut(1)); + information.add(buttonPanel); + information.add(Box.createVerticalStrut(10)); + //Add the simulation speed slider + information.add(new JLabel("Simulation speed:")); + information.add(Box.createVerticalStrut(3)); + speedSlider = new JSlider(0, 1500, 1500-World.getInstance().getTimelapse()); + speedSlider.setMajorTickSpacing(300); + speedSlider.setMinorTickSpacing(50); + speedSlider.setPaintTicks(true); + speedSlider.setSnapToTicks(true); + information.add(speedSlider); + information.add(Box.createVerticalStrut(10)); + //Add the "Pause at update:" function + Box stopPanel = new Box(BoxLayout.X_AXIS); + JLabel stopLabel = new JLabel("Pause at update:"); + stopAtField = new JTextField(5); + stopAtField.setMaximumSize(stopAtField.getPreferredSize()); + stopAtField.setText(Integer.toString(World.getInstance().getStopAt())); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.add(stopLabel); + stopPanel.add(Box.createVerticalStrut(1)); + stopPanel.add(stopAtField); + stopPanel.add(Box.createVerticalStrut(3)); + stopPanel.setMaximumSize(stopPanel.getPreferredSize()); + information.add(stopPanel); + information.add(Box.createVerticalStrut(10)); + //Add the disable display check box + disableDisplay = new JCheckBox("Freeze display"); + information.add(disableDisplay); + information.add(Box.createVerticalStrut(10)); + } + + /** + * Add the actual display. + */ + private void addDisplay() + { + display = new Display(World.getInstance().getSize()); + scrollscreen = new JScrollPane(display, JScrollPane. VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + this.add(scrollscreen, BorderLayout.CENTER); + } + + /** + * Destroy all windows in preparation for a new run. + */ + public void reset() + { + EcologiaIO.debug("Resetting the GUI."); + programConfig.dispose(); + simulationConfig.dispose(); + genomeConfig.dispose(); + helpWindow.dispose(); + display.getInfoBox().dispose(); + this.dispose(); + } + + /** + * Display news items on the ticker + */ + public void displayNews() + { + EcologiaIO.debug("GUI: updating news."); + ArrayList news = World.getInstance().collectNews(); + if (!news.isEmpty()) { + for (int i = 0; i < news.size(); i++) { + ticker.append("\n"+news.get(i)); + } + World.getInstance().giveNews(null); //reset the news list + ticker.setCaretPosition(ticker.getText().length()); //XXX Expensive? + } + } + +} diff --git a/src/view/GenomeConfig.java b/src/view/GenomeConfig.java new file mode 100755 index 0000000..ecb9928 --- /dev/null +++ b/src/view/GenomeConfig.java @@ -0,0 +1,246 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class provides GUI configuration facilities + * for setting default genome values. + * + * @author Daniel Vedder + * @version 1.1.2015 + */ +public class GenomeConfig extends JFrame +{ + private Box mainBox; + private JComboBox typeChooser; + private JTextField mutationRate, speed, stamina, sight, metabolism, ageLimit, strength; + private JTextField reproductiveEnergy, maturityAge, gestation, reproductionRate; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public GenomeConfig() + { + this.setTitle("Genome Configuration"); + this.setSize(290, 500); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawGenomeConfigWindow(); + } + + /** + * Create the interface + */ + public void drawGenomeConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + JLabel heading = new JLabel("Initial Genome Settings"); + //Animal type chooser + Box typePanel = new Box(BoxLayout.X_AXIS); + JLabel type = new JLabel("Animal type: "); + typeChooser = new JComboBox(new String[] {OccupantType.HERBIVORE.toString(), + OccupantType.CARNIVORE.toString()}); + typeChooser.setMaximumSize(new Dimension(140, 30)); + typeChooser.setSelectedItem(OccupantType.HERBIVORE.toString()); + typeChooser.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + update(); + } + }); + typePanel.add(type); + typePanel.add(typeChooser); + //Genome variables + Box mrBox = new Box(BoxLayout.X_AXIS); + JLabel mrLabel = new JLabel("Mutation rate: "); + mutationRate = new JTextField(3); + mrBox.add(mrLabel); + mrBox.add(Box.createHorizontalStrut(80)); + mrBox.add(mutationRate); + Box speedBox = new Box(BoxLayout.X_AXIS); + JLabel speedLabel = new JLabel("Speed: "); + speed = new JTextField(3); + speedBox.add(speedLabel); + speedBox.add(Box.createHorizontalStrut(135)); + speedBox.add(speed); + Box staminaBox = new Box(BoxLayout.X_AXIS); + JLabel staminaLabel = new JLabel("Stamina: "); + stamina = new JTextField(3); + staminaBox.add(staminaLabel); + staminaBox.add(Box.createHorizontalStrut(135)); + staminaBox.add(stamina); + Box sightBox = new Box(BoxLayout.X_AXIS); + JLabel sightLabel = new JLabel("Sight: "); + sight = new JTextField(3); + sightBox.add(sightLabel); + sightBox.add(Box.createHorizontalStrut(140)); + sightBox.add(sight); + Box metabolismBox = new Box(BoxLayout.X_AXIS); + JLabel metabolismLabel = new JLabel("Metabolic efficiency: "); + metabolism = new JTextField(3); + metabolismBox.add(metabolismLabel); + metabolismBox.add(Box.createHorizontalStrut(40)); + metabolismBox.add(metabolism); + Box alBox = new Box(BoxLayout.X_AXIS); + JLabel alLabel = new JLabel("Age limit: "); + ageLimit = new JTextField(3); + alBox.add(alLabel); + alBox.add(Box.createHorizontalStrut(120)); + alBox.add(ageLimit); + Box strengthBox = new Box(BoxLayout.X_AXIS); + JLabel strengthLabel = new JLabel("Strength: "); + strength = new JTextField(3); + strengthBox.add(strengthLabel); + strengthBox.add(Box.createHorizontalStrut(120)); + strengthBox.add(strength); + Box reBox = new Box(BoxLayout.X_AXIS); + JLabel reLabel = new JLabel("Reproductive energy: "); + reproductiveEnergy = new JTextField(3); + reBox.add(reLabel); + reBox.add(Box.createHorizontalStrut(40)); + reBox.add(reproductiveEnergy); + Box maBox = new Box(BoxLayout.X_AXIS); + JLabel maLabel = new JLabel("Maturity age: "); + maturityAge = new JTextField(3); + maBox.add(maLabel); + maBox.add(Box.createHorizontalStrut(90)); + maBox.add(maturityAge); + Box geBox = new Box(BoxLayout.X_AXIS); + JLabel geLabel = new JLabel("Gestation period: "); + gestation = new JTextField(3); + geBox.add(geLabel); + geBox.add(Box.createHorizontalStrut(90)); + geBox.add(gestation); + Box rrBox = new Box(BoxLayout.X_AXIS); + JLabel rrLabel = new JLabel("Reproduction rate: "); + reproductionRate = new JTextField(3); + rrBox.add(rrLabel); + rrBox.add(Box.createHorizontalStrut(90)); + rrBox.add(reproductionRate); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) { + updateWorld(); + EcologiaIO.log("GenomeConfig: Genome settings for "+ + typeChooser.getSelectedItem()+" updated in World!"); + } + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(typePanel); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(mrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(speedBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(staminaBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(sightBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(metabolismBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(alBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(strengthBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(reBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(maBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(geBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(rrBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + //Add all the boxes + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Update the box and make it visible + * @param showRestart Show the restart dialog when closing this window? + */ + public void showGenomeConfig(boolean showRestart) + { + EcologiaIO.debug("GenomeConfig: showing genome config window."); + showRestartDialog = showRestart; + update(); + this.setVisible(true); + } + + /** + * Update all the text fields. + */ + private void update() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + HashMap genomeInfo = World.getInstance().getDefaultGenome(currentType); + mutationRate.setText(Integer.toString(genomeInfo.get("mutationRate"))); + speed.setText(Integer.toString(genomeInfo.get("speed"))); + stamina.setText(Integer.toString(genomeInfo.get("stamina"))); + sight.setText(Integer.toString(genomeInfo.get("sight"))); + metabolism.setText(Integer.toString(genomeInfo.get("metabolism"))); + ageLimit.setText(Integer.toString(genomeInfo.get("ageLimit"))); + strength.setText(Integer.toString(genomeInfo.get("strength"))); + reproductiveEnergy.setText(Integer.toString(genomeInfo.get("reproductiveEnergy"))); + maturityAge.setText(Integer.toString(genomeInfo.get("maturityAge"))); + gestation.setText(Integer.toString(genomeInfo.get("gestation"))); + reproductionRate.setText(Integer.toString(genomeInfo.get("reproductionRate"))); + } + + /** + * Update the default genome values + */ + private void updateWorld() + { + OccupantType currentType = OccupantType.fromString((String) typeChooser.getSelectedItem()); + int setMutationRate = new Integer(mutationRate.getText()); + int setSpeed = new Integer(speed.getText()); + int setStamina = new Integer(stamina.getText()); + int setSight = new Integer(sight.getText()); + int setMetabolism = new Integer(metabolism.getText()); + int setAgeLimit = new Integer(ageLimit.getText()); + int setStrength = new Integer(strength.getText()); + int setReproductiveEnergy = new Integer(reproductiveEnergy.getText()); + int setMaturityAge = new Integer(maturityAge.getText()); + int setGestation = new Integer(gestation.getText()); + int setReproductionRate = new Integer(reproductionRate.getText()); + World.getInstance().setDefaultGenome(currentType, setMutationRate, setSpeed, setStamina, + setSight, setMetabolism, setAgeLimit, setStrength, + setReproductiveEnergy, setMaturityAge, setGestation, + setReproductionRate); + } +} diff --git a/src/view/HelpWindow.java b/src/view/HelpWindow.java new file mode 100755 index 0000000..8528ee3 --- /dev/null +++ b/src/view/HelpWindow.java @@ -0,0 +1,118 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; +import java.io.*; + +import main.Ecologia; +import main.EcologiaIO; + +/** + * This window displays the help file for Ecologia. + * + * @author Daniel Vedder + * @version 03.03.2015 + */ +@SuppressWarnings("serial") +public class HelpWindow extends JFrame +{ + JTextArea text; + JScrollPane scroller; + Box main_panel, button_panel; + JButton help, concepts, license; + + public HelpWindow() + { + this.setTitle("Help"); + this.setSize(580, 450); + this.setLocation(300, 150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + createGUI(); + loadDocFile("help"); + } + + /** + * Add the text area which will display the text and the buttons to choose + * which text to display. + */ + public void createGUI() + { + //Add the text area + main_panel = new Box(BoxLayout.Y_AXIS); + text = new JTextArea(); + text.setEditable(false); + text.setLineWrap(true); + text.setWrapStyleWord(true); + scroller = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + main_panel.add(scroller); + main_panel.add(Box.createVerticalStrut(5)); + //Add the buttons + help = new JButton("Help"); + concepts = new JButton("Concepts"); + license = new JButton("License"); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("help"); + } + }); + concepts.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("concepts"); + } + }); + license.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadDocFile("COPYING"); + } + }); + button_panel = new Box(BoxLayout.X_AXIS); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(help); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(concepts); + button_panel.add(Box.createVerticalStrut(3)); + button_panel.add(license); + button_panel.add(Box.createVerticalStrut(3)); + main_panel.add(button_panel); + this.add(main_panel, BorderLayout.CENTER); + //Add some fillers for the optics + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.WEST); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + /** + * Load a documentation file. + * @param String fileName + */ + public void loadDocFile(String filename) + { + String helptext = ""; + try { + InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream("/doc/"+filename)); + BufferedReader helpfile_reader = new BufferedReader(isr); + String line = helpfile_reader.readLine(); + while (line != null) { + helptext = helptext+line+"\n"; + line = helpfile_reader.readLine(); + } + helpfile_reader.close(); + } + catch (IOException ioe) { + helptext = "Error loading file!"; + EcologiaIO.error("HelpWindow: could not load file 'doc/"+filename+"'!", ioe); + } + text.setText(helptext); + text.setCaretPosition(0); + } +} diff --git a/src/view/InfoBox.java b/src/view/InfoBox.java new file mode 100755 index 0000000..23080b5 --- /dev/null +++ b/src/view/InfoBox.java @@ -0,0 +1,189 @@ +package view; + +import java.awt.BorderLayout; +import java.util.HashMap; + +import javax.swing.*; + +import main.EcologiaIO; +import controller.Humidity; +import controller.OccupantType; +import controller.World; + +/** + * This class is responsible for displaying information about a tile that was + * clicked on in the simulator. + * + * @author Daniel Vedder + * @version 4.9.2014 + */ +public class InfoBox extends JFrame +{ + private int xtile, ytile; //The coordinates of the currently active tile + private HashMap animalInfo; + private JTabbedPane tab_pane; + private Box tile_box, animal_box; + private JLabel coordinates, occupied_by, humidity, grasslevel; //JLabels needed for the tile panel + private JLabel id, type, energy, age, generation, parent, offspring, speed, stamina, efficiency; + private JLabel age_limit, strength, rep_energy, mat_age, gestation, repr_rate, eyesight, mut_rate; //JLabels needed for the animal panel + + /** + * The constructor. + */ + public InfoBox() + { + this.setTitle("Information"); + this.setSize(230, 380); + this.setLocation(400,150); + this.setAlwaysOnTop(true); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawInfoBox(); + } + + /** + * Initialise the infobox. + */ + private void drawInfoBox() + { + tab_pane = new JTabbedPane(); + this.add(tab_pane, BorderLayout.CENTER); + drawTileBox(); + drawAnimalBox(); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Draw the tile box. + */ + private void drawTileBox() + { + tile_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Tile", tile_box); + coordinates = new JLabel(); //Coordinates + tile_box.add(coordinates); + tile_box.add(Box.createVerticalStrut(10)); + occupied_by = new JLabel(); //Occupant + tile_box.add(occupied_by); + humidity = new JLabel(); //Humidity + tile_box.add(humidity); + grasslevel = new JLabel(); //Grass Density + tile_box.add(grasslevel); + } + + /** + * Draw the animal box. + */ + private void drawAnimalBox() + { + animal_box = new Box(BoxLayout.Y_AXIS); + tab_pane.addTab("Animal", animal_box); + id = new JLabel("Animal ID: "); //ID number + animal_box.add(id); + type = new JLabel("Type: "); //Type + animal_box.add(type); + animal_box.add(Box.createVerticalStrut(10)); + energy = new JLabel("Energy: "); //Energy + animal_box.add(energy); + age = new JLabel("Age: "); //Age + animal_box.add(age); + generation = new JLabel("Generation: "); //Generation + animal_box.add(generation); + parent = new JLabel("Parent: "); //Parent ID + animal_box.add(parent); + offspring = new JLabel("Offspring: "); //Offspring + animal_box.add(offspring); + animal_box.add(Box.createVerticalStrut(10)); + animal_box.add(new JLabel("Genome")); + animal_box.add(Box.createVerticalStrut(5)); + speed = new JLabel("Speed: "); //Speed + animal_box.add(speed); + stamina = new JLabel("Stamina: "); //Speed + animal_box.add(stamina); + efficiency = new JLabel("Metabolic efficiency: "); //Efficiency + animal_box.add(efficiency); + age_limit = new JLabel("Age limit: "); //Age limit + animal_box.add(age_limit); + strength = new JLabel("Strength: "); //Strength + animal_box.add(strength); + rep_energy = new JLabel("Reproductive energy: "); //Reproduction energy + animal_box.add(rep_energy); + mat_age = new JLabel("Sexual maturity age: "); //Age of sexual maturity + animal_box.add(mat_age); + gestation = new JLabel("Gestation period: "); //Minimum length of the reproductive cycle + animal_box.add(gestation); + repr_rate = new JLabel("Reproduction rate: "); //Number of offspring per reproduction + animal_box.add(repr_rate); + eyesight = new JLabel("Eyesight range: "); //Eyesight + animal_box.add(eyesight); + mut_rate = new JLabel("Mutation rate: "); //Mutation rate + animal_box.add(mut_rate); + } + + /** + * Displays the information about the specified tile + * @param int Tile coordinates + */ + public void show(int tileX, int tileY) + { + xtile = tileX; + ytile = tileY; + refresh(); + this.setVisible(true); + EcologiaIO.debug("Showing InfoBox for ("+xtile+"/"+ytile+")"); + } + + /** + * Refresh the Infobox with the data of a new tile. + */ + public void refresh() + { + animalInfo = World.getInstance().getAnimalInfo(xtile, ytile); + coordinates.setText("Tile: "+xtile+"/"+ytile); + occupied_by.setText("Occupant: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + humidity.setText("Humidity: "+Humidity.getStatus(World.getInstance().getFieldInfo(xtile, ytile).get("Local humidity")).getString()); + grasslevel.setText("Grass density: "+World.getInstance().getFieldInfo(xtile, ytile).get("Grass density")); + if (animalInfo != null) { //Only display information if an animal actually occupies the tile + id.setText("Animal ID: "+animalInfo.get("ID")); + type.setText("Type: "+OccupantType.fromInt(animalInfo.get("Type")).toString()); + energy.setText("Energy: "+animalInfo.get("Energy")); + age.setText("Age: "+animalInfo.get("Age")); + generation.setText("Generation: "+animalInfo.get("Generation")); + parent.setText("Parent: "+animalInfo.get("Parent")); + offspring.setText("Offspring: "+animalInfo.get("Offspring")); + speed.setText("Speed: "+animalInfo.get("Speed")); + stamina.setText("Stamina: "+animalInfo.get("Stamina")); + efficiency.setText("Efficiency: "+animalInfo.get("Metabolism")); + age_limit.setText("Age limit: "+animalInfo.get("Age limit")); + strength.setText("Strength: "+animalInfo.get("Strength")); + rep_energy.setText("Reproductive energy: "+animalInfo.get("Reproductive energy")); + mat_age.setText("Age of maturity: "+animalInfo.get("Maturity age")); + gestation.setText("Gestation period: "+animalInfo.get("Gestation")); + repr_rate.setText("Reproduction rate: "+animalInfo.get("Reproduction rate")); + eyesight.setText("Range of eyesight: "+animalInfo.get("Sight")); + mut_rate.setText("Mutation rate: "+animalInfo.get("Mutation rate")); + } + else { //If there is no animal here, display N/A + id.setText("Animal ID: N/A"); + type.setText("Type: "+OccupantType.fromInt(World.getInstance().getFieldInfo(xtile, ytile).get("Occupant")).toString()); + energy.setText("Energy: N/A"); + age.setText("Age: N/A"); + generation.setText("Generation: N/A"); + parent.setText("Parent: N/A"); + offspring.setText("Offspring: N/A"); + speed.setText("Speed: N/A"); + stamina.setText("Stamina: N/A"); + efficiency.setText("Efficiency: N/A"); + age_limit.setText("Age limit: N/A"); + strength.setText("Strength: N/A"); + rep_energy.setText("Reproductive energy: N/A"); + mat_age.setText("Age of maturity: N/A"); + gestation.setText("Gestation period: N/A"); + repr_rate.setText("Reproduction rate: N/A"); + eyesight.setText("Range of eyesight: N/A"); + mut_rate.setText("Mutation rate: N/A"); + } + } + +} diff --git a/src/view/ProgramConfig.java b/src/view/ProgramConfig.java new file mode 100755 index 0000000..22428cd --- /dev/null +++ b/src/view/ProgramConfig.java @@ -0,0 +1,112 @@ +package view; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.BorderLayout; + +import javax.swing.*; + +import main.Ecologia; +import main.EcologiaIO; +import controller.World; + +/** + * This class provides a GUI to configure program options (these can + * also be set via commandline flags). + * + * @author Daniel Vedder + * @version 22.03.2015 + */ +public class ProgramConfig extends JFrame +{ + private Box mainBox; + private JLabel heading; + private JCheckBox logging, debug, verbose, analyse; + private JButton apply; + + /** + * The constructor + */ + public ProgramConfig() + { + this.setTitle("Program Configuration"); + this.setSize(250, 230); + this.setLocation(300,200); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawConfigWindow(); + } + + private void drawConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + heading = new JLabel("Initial Parameter Settings"); + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + logging = new JCheckBox("Turn on logging"); + mainBox.add(logging); + mainBox.add(Box.createVerticalStrut(5)); + verbose = new JCheckBox("Provide verbose output"); + mainBox.add(verbose); + mainBox.add(Box.createVerticalStrut(5)); + debug = new JCheckBox("Print debug information"); + mainBox.add(debug); + mainBox.add(Box.createVerticalStrut(5)); + analyse = new JCheckBox("Print analysis information"); + mainBox.add(analyse); + mainBox.add(Box.createVerticalStrut(10)); + apply = new JButton("Apply"); + mainBox.add(apply); + mainBox.add(Box.createVerticalStrut(5)); + apply.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + updateWorld(); + setVisible(false); + } + }); + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Show the configuration window + * @param showRestart Show the restart dialog when closing this window? + */ + public void showConfig() + { + EcologiaIO.debug("ProgramConfig: showing config window."); + refresh(); + this.setVisible(true); + } + + /** + * Refresh values displayed in the text fields. + */ + public void refresh() + { + logging.setSelected(EcologiaIO.logging); + verbose.setSelected(EcologiaIO.verbose); + debug.setSelected(EcologiaIO.debugging); + analyse.setSelected(EcologiaIO.analysing); + } + + /** + * Extract all the settings from the text fields and update the world parameters + */ + public void updateWorld() + { + EcologiaIO.logging = logging.isSelected(); + EcologiaIO.verbose = verbose.isSelected(); + EcologiaIO.debugging = debug.isSelected(); + EcologiaIO.analysing = analyse.isSelected(); + EcologiaIO.printStatus(); + if (logging.isSelected()) + World.getInstance().giveNews("Logging to "+System.getProperty("user.dir")+"/ecologia.log"); + } +} diff --git a/src/view/SimulationConfig.java b/src/view/SimulationConfig.java new file mode 100755 index 0000000..05566bd --- /dev/null +++ b/src/view/SimulationConfig.java @@ -0,0 +1,179 @@ +package view; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.*; + +import controller.World; +import main.Ecologia; +import main.EcologiaIO; + +/** + * This class is used to graphically configure simulation parameters + * prior to the start of a run. + * + * @author Daniel Vedder + * @version 30.12.2014 + */ +public class SimulationConfig extends JFrame +{ + private Box mainBox; + private JLabel heading, dimensions, waterLabel, nCarnLabel, nHerbLabel, grassLabel, energyCarnLabel, energyHerbLabel; + private JTextField width, height, no_water_tiles, no_carnivores, no_herbivores, grassDensity, energyHerbivores, energyCarnivores; + private JButton confirm; + private boolean showRestartDialog; + + /** + * The constructor + */ + public SimulationConfig() + { + this.setTitle("Simulation Configuration"); + this.setSize(320, 320); + this.setLocation(400,150); + this.setDefaultCloseOperation(HIDE_ON_CLOSE); + drawConfigWindow(); + } + + /** + * Create the interface + */ + private void drawConfigWindow() + { + mainBox = new Box(BoxLayout.Y_AXIS); + heading = new JLabel("Initial Parameter Settings"); + //Dimension settings + dimensions = new JLabel("World dimensions (x*y): "); + width = new JTextField(String.valueOf(World.getInstance().getSize()[0]), 4); + height = new JTextField(String.valueOf(World.getInstance().getSize()[1]), 4); + Box dimBox = new Box(BoxLayout.X_AXIS); + dimBox.add(dimensions); + dimBox.add(Box.createHorizontalStrut(15)); + dimBox.add(width); + dimBox.add(Box.createHorizontalStrut(15)); + dimBox.add(height); + //Initial numbers of animals and water tiles + Box waterBox = new Box(BoxLayout.X_AXIS); + waterLabel = new JLabel("Number of water tiles: "); + no_water_tiles = new JTextField(String.valueOf(World.getInstance().getWaterTiles()), 3); + waterBox.add(waterLabel); + waterBox.add(Box.createHorizontalStrut(30)); + waterBox.add(no_water_tiles); + Box grassBox = new Box(BoxLayout.X_AXIS); + grassLabel = new JLabel("Starting grass density: "); + grassDensity = new JTextField(String.valueOf(World.getInstance().getStartGrassDensity()), 4); + grassBox.add(grassLabel); + grassBox.add(Box.createHorizontalStrut(25)); + grassBox.add(grassDensity); + Box nCarnBox = new Box(BoxLayout.X_AXIS); + nCarnLabel = new JLabel("Number of carnivores: "); + no_carnivores = new JTextField(String.valueOf(World.getInstance().getStartNoCarnivores()), 3); + nCarnBox.add(nCarnLabel); + nCarnBox.add(Box.createHorizontalStrut(25)); + nCarnBox.add(no_carnivores); + Box nHerbBox = new Box(BoxLayout.X_AXIS); + nHerbLabel = new JLabel("Number of herbivores: "); + no_herbivores = new JTextField(String.valueOf(World.getInstance().getStartNoHerbivores()), 3); + nHerbBox.add(nHerbLabel); + nHerbBox.add(Box.createHorizontalStrut(25)); + nHerbBox.add(no_herbivores); + //Initial energy for the animals + Box energyCarnBox = new Box(BoxLayout.X_AXIS); + energyCarnLabel = new JLabel("Start energy carnivores: "); + energyCarnivores = new JTextField(String.valueOf(World.getInstance().getStartEnergyCarnivores()), 4); + energyCarnBox.add(energyCarnLabel); + energyCarnBox.add(Box.createHorizontalStrut(25)); + energyCarnBox.add(energyCarnivores); + Box energyHerbBox = new Box(BoxLayout.X_AXIS); + energyHerbLabel = new JLabel("Start energy herbivores: "); + energyHerbivores = new JTextField(String.valueOf(World.getInstance().getStartEnergyHerbivores()), 4); + energyHerbBox.add(energyHerbLabel); + energyHerbBox.add(Box.createHorizontalStrut(25)); + energyHerbBox.add(energyHerbivores); + //The confirm button + confirm = new JButton("Confirm"); + confirm.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + EcologiaIO.log("SimulationConfig: World parameter settings updated."); + if (showRestartDialog) { + int restart = JOptionPane.showConfirmDialog(null, + "Please note: The new settings will only take \neffect on the next run.\nRestart now?", "Restart?", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (restart != JOptionPane.CANCEL_OPTION) updateWorld(); + if (restart == JOptionPane.YES_OPTION) Ecologia.getInstance().reset(); + } + setVisible(false); + } + }); + //Draw everything + mainBox.add(heading); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(new JSeparator()); + mainBox.add(Box.createVerticalStrut(5)); + mainBox.add(dimBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(grassBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(waterBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(nCarnBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(nHerbBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(energyCarnBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(energyHerbBox); + mainBox.add(Box.createVerticalStrut(10)); + mainBox.add(confirm); + this.add(mainBox, BorderLayout.CENTER); + this.add(new JPanel(), BorderLayout.NORTH); + this.add(new JPanel(), BorderLayout.EAST); + this.add(new JPanel(), BorderLayout.SOUTH); + this.add(new JPanel(), BorderLayout.WEST); + } + + /** + * Show the configuration window + * @param showRestart Show the restart dialog when closing this window? + */ + public void showConfig(boolean showRestart) + { + EcologiaIO.debug("SimulationConfig: showing config window."); + showRestartDialog = showRestart; + refresh(); + this.setVisible(true); + } + + /** + * Refresh values displayed in the text fields. + */ + public void refresh() + { + width.setText(String.valueOf(World.getInstance().getSize()[0])); + height.setText(String.valueOf(World.getInstance().getSize()[1])); + grassDensity.setText(String.valueOf(World.getInstance().getStartGrassDensity())); + no_water_tiles.setText(String.valueOf(World.getInstance().getWaterTiles())); + no_carnivores.setText(String.valueOf(World.getInstance().getStartNoCarnivores())); + no_herbivores.setText(String.valueOf(World.getInstance().getStartNoHerbivores())); + energyCarnivores.setText(String.valueOf(World.getInstance().getStartEnergyCarnivores())); + energyHerbivores.setText(String.valueOf(World.getInstance().getStartEnergyHerbivores())); + } + + /** + * Extract all the settings from the text fields and update the world parameters + */ + public void updateWorld() + { + World.getInstance().setSize(new int[] {new Integer(width.getText()), new Integer(height.getText())}); + World.getInstance().setStartGrassDensity(new Integer(grassDensity.getText())); + World.getInstance().setStartNoWaterTiles(new Integer(no_water_tiles.getText())); + World.getInstance().setStartNoHerbivores(new Integer(no_herbivores.getText())); + World.getInstance().setStartNoCarnivores(new Integer(no_carnivores.getText())); + World.getInstance().setStartEnergyCarnivores(new Integer(energyCarnivores.getText())); + World.getInstance().setStartEnergyHerbivores(new Integer(energyHerbivores.getText())); + } +} diff --git a/src/view/package-info.java b/src/view/package-info.java new file mode 100755 index 0000000..231c4d6 --- /dev/null +++ b/src/view/package-info.java @@ -0,0 +1,8 @@ +/** + * view is responsible for displaying the current status of the simulation and + * provides a graphical user interface. + * + * @author Daniel Vedder + * + */ +package view;